Use idiomatic AssertJ assertions for true, false, and null

This commit is contained in:
Sam Brannen 2022-01-10 14:15:55 +01:00
parent 2a80b64d40
commit df263d01b9
75 changed files with 345 additions and 333 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -74,7 +74,7 @@ class ScheduledAndTransactionalAnnotationIntegrationTests {
MyRepository repository = ctx.getBean(MyRepository.class);
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
assertThat(AopUtils.isCglibProxy(repository)).isEqualTo(true);
assertThat(AopUtils.isCglibProxy(repository)).isTrue();
assertThat(repository.getInvocationCount()).isGreaterThan(0);
assertThat(txManager.commits).isGreaterThan(0);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -46,7 +46,7 @@ public class BeanWrapperEnumTests {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", null);
assertThat(gb.getCustomEnum()).isEqualTo(null);
assertThat(gb.getCustomEnum()).isNull();
}
@Test
@ -54,7 +54,7 @@ public class BeanWrapperEnumTests {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", "");
assertThat(gb.getCustomEnum()).isEqualTo(null);
assertThat(gb.getCustomEnum()).isNull();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -433,7 +433,7 @@ class DefaultListableBeanFactoryTests {
assertThat(lbf.isTypeMatch("x1", Object.class)).isTrue();
assertThat(lbf.isTypeMatch("&x1", Object.class)).isFalse();
assertThat(lbf.getType("x1")).isEqualTo(TestBean.class);
assertThat(lbf.getType("&x1")).isEqualTo(null);
assertThat(lbf.getType("&x1")).isNull();
assertThat(TestBeanFactory.initialized).isFalse();
lbf.registerAlias("x1", "x2");
@ -2622,8 +2622,8 @@ class DefaultListableBeanFactoryTests {
void containsBeanReturnsTrueEvenForAbstractBeanDefinition() {
lbf.registerBeanDefinition("abs", BeanDefinitionBuilder
.rootBeanDefinition(TestBean.class).setAbstract(true).getBeanDefinition());
assertThat(lbf.containsBean("abs")).isEqualTo(true);
assertThat(lbf.containsBean("bogus")).isEqualTo(false);
assertThat(lbf.containsBean("abs")).isTrue();
assertThat(lbf.containsBean("bogus")).isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -111,7 +111,7 @@ public class PropertyResourceConfigurerTests {
assertThat(tb1.getAge()).isEqualTo(99);
assertThat(tb2.getAge()).isEqualTo(99);
assertThat(tb1.getName()).isEqualTo(null);
assertThat(tb1.getName()).isNull();
assertThat(tb2.getName()).isEqualTo("test");
}
@ -310,7 +310,7 @@ public class PropertyResourceConfigurerTests {
TestBean tb2 = (TestBean) factory.getBean("tb2");
assertThat(tb1.getAge()).isEqualTo(99);
assertThat(tb2.getAge()).isEqualTo(99);
assertThat(tb1.getName()).isEqualTo(null);
assertThat(tb1.getName()).isNull();
assertThat(tb2.getName()).isEqualTo("test");
}
@ -423,7 +423,7 @@ public class PropertyResourceConfigurerTests {
TestBean inner1 = (TestBean) tb2.getSomeMap().get("key3");
TestBean inner2 = (TestBean) tb2.getSomeMap().get("mykey4");
assertThat(inner1.getAge()).isEqualTo(0);
assertThat(inner1.getName()).isEqualTo(null);
assertThat(inner1.getName()).isNull();
assertThat(inner1.getCountry()).isEqualTo(System.getProperty("os.name"));
assertThat(inner2.getAge()).isEqualTo(98);
assertThat(inner2.getName()).isEqualTo("namemyvarmyvar${");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -449,7 +449,7 @@ public class CallbacksSecurityTests {
public Object run() {
// sanity check
assertThat(getCurrentSubjectName()).isEqualTo("user1");
assertThat(NonPrivilegedBean.destroyed).isEqualTo(false);
assertThat(NonPrivilegedBean.destroyed).isFalse();
beanFactory.getBean("trusted-spring-callbacks");
beanFactory.getBean("trusted-custom-init-destroy");
@ -465,7 +465,7 @@ public class CallbacksSecurityTests {
beanFactory.getBean("trusted-working-property-injection");
beanFactory.destroySingletons();
assertThat(NonPrivilegedBean.destroyed).isEqualTo(true);
assertThat(NonPrivilegedBean.destroyed).isTrue();
return null;
}
}, provider.getAccessControlContext());

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -100,17 +100,17 @@ public class FactoryMethodTests {
FactoryMethods fm = (FactoryMethods) xbf.getBean("fullWithNull");
assertThat(fm.getNum()).isEqualTo(27);
assertThat(fm.getName()).isEqualTo(null);
assertThat(fm.getName()).isNull();
assertThat(fm.getTestBean().getName()).isEqualTo("Juergen");
fm = (FactoryMethods) xbf.getBean("fullWithGenericNull");
assertThat(fm.getNum()).isEqualTo(27);
assertThat(fm.getName()).isEqualTo(null);
assertThat(fm.getName()).isNull();
assertThat(fm.getTestBean().getName()).isEqualTo("Juergen");
fm = (FactoryMethods) xbf.getBean("fullWithNamedNull");
assertThat(fm.getNum()).isEqualTo(27);
assertThat(fm.getName()).isEqualTo(null);
assertThat(fm.getName()).isNull();
assertThat(fm.getTestBean().getName()).isEqualTo("Juergen");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -342,7 +342,7 @@ public class UtilNamespaceHandlerTests {
public void testLoadProperties() {
Properties props = (Properties) this.beanFactory.getBean("myProperties");
assertThat(props.get("foo")).as("Incorrect property value").isEqualTo("bar");
assertThat(props.get("foo2")).as("Incorrect property value").isEqualTo(null);
assertThat(props.get("foo2")).as("Incorrect property value").isNull();
Properties props2 = (Properties) this.beanFactory.getBean("myProperties");
assertThat(props == props2).isTrue();
}
@ -351,17 +351,17 @@ public class UtilNamespaceHandlerTests {
public void testScopedProperties() {
Properties props = (Properties) this.beanFactory.getBean("myScopedProperties");
assertThat(props.get("foo")).as("Incorrect property value").isEqualTo("bar");
assertThat(props.get("foo2")).as("Incorrect property value").isEqualTo(null);
assertThat(props.get("foo2")).as("Incorrect property value").isNull();
Properties props2 = (Properties) this.beanFactory.getBean("myScopedProperties");
assertThat(props.get("foo")).as("Incorrect property value").isEqualTo("bar");
assertThat(props.get("foo2")).as("Incorrect property value").isEqualTo(null);
assertThat(props.get("foo2")).as("Incorrect property value").isNull();
assertThat(props != props2).isTrue();
}
@Test
public void testLocalProperties() {
Properties props = (Properties) this.beanFactory.getBean("myLocalProperties");
assertThat(props.get("foo")).as("Incorrect property value").isEqualTo(null);
assertThat(props.get("foo")).as("Incorrect property value").isNull();
assertThat(props.get("foo2")).as("Incorrect property value").isEqualTo("bar2");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -283,7 +283,7 @@ public class XmlBeanCollectionTests {
Iterator it = hasMap.getSet().iterator();
assertThat(it.next()).isEqualTo("bar");
assertThat(it.next()).isEqualTo(jenny);
assertThat(it.next()).isEqualTo(null);
assertThat(it.next()).isNull();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -181,7 +181,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
assertThat(beanNames.contains("aliasWithoutId3")).isFalse();
TestBean tb4 = (TestBean) getBeanFactory().getBean(TestBean.class.getName() + "#0");
assertThat(tb4.getName()).isEqualTo(null);
assertThat(tb4.getName()).isNull();
Map drs = getListableBeanFactory().getBeansOfType(DummyReferencer.class, false, false);
assertThat(drs.size()).isEqualTo(5);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -106,7 +106,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache>
Cache.ValueWrapper wrapper = cache.putIfAbsent(key, "anotherValue");
// A value is set but is 'null'
assertThat(wrapper).isNotNull();
assertThat(wrapper.get()).isEqualTo(null);
assertThat(wrapper.get()).isNull();
// not changed
assertThat(cache.get(key).get()).isEqualTo(value);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -196,7 +196,7 @@ class CommonsPool2TargetSourceTests {
void testSetWhenExhaustedAction() {
CommonsPool2TargetSource targetSource = new CommonsPool2TargetSource();
targetSource.setBlockWhenExhausted(true);
assertThat(targetSource.isBlockWhenExhausted()).isEqualTo(true);
assertThat(targetSource.isBlockWhenExhausted()).isTrue();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -876,7 +876,7 @@ class XmlBeanFactoryTests {
// should have been autowired
assertThat(rod1.getSpouse1()).isEqualTo(kerry);
assertThat(rod1.getAge()).isEqualTo(0);
assertThat(rod1.getName()).isEqualTo(null);
assertThat(rod1.getName()).isNull();
ConstructorDependenciesBean rod2 = (ConstructorDependenciesBean) xbf.getBean("rod2");
TestBean kerry1 = (TestBean) xbf.getBean("kerry1");
@ -885,7 +885,7 @@ class XmlBeanFactoryTests {
assertThat(rod2.getSpouse1()).isEqualTo(kerry2);
assertThat(rod2.getSpouse2()).isEqualTo(kerry1);
assertThat(rod2.getAge()).isEqualTo(0);
assertThat(rod2.getName()).isEqualTo(null);
assertThat(rod2.getName()).isNull();
ConstructorDependenciesBean rod = (ConstructorDependenciesBean) xbf.getBean("rod3");
IndexedTestBean other = (IndexedTestBean) xbf.getBean("other");
@ -894,7 +894,7 @@ class XmlBeanFactoryTests {
assertThat(rod.getSpouse2()).isEqualTo(kerry);
assertThat(rod.getOther()).isEqualTo(other);
assertThat(rod.getAge()).isEqualTo(0);
assertThat(rod.getName()).isEqualTo(null);
assertThat(rod.getName()).isNull();
xbf.getBean("rod4", ConstructorDependenciesBean.class);
// should have been autowired
@ -902,7 +902,7 @@ class XmlBeanFactoryTests {
assertThat(rod.getSpouse2()).isEqualTo(kerry);
assertThat(rod.getOther()).isEqualTo(other);
assertThat(rod.getAge()).isEqualTo(0);
assertThat(rod.getName()).isEqualTo(null);
assertThat(rod.getName()).isNull();
}
@Test
@ -929,7 +929,7 @@ class XmlBeanFactoryTests {
assertThat(rod6.getSpouse2()).isEqualTo(kerry1);
assertThat(rod6.getOther()).isEqualTo(other);
assertThat(rod6.getAge()).isEqualTo(0);
assertThat(rod6.getName()).isEqualTo(null);
assertThat(rod6.getName()).isNull();
xbf.destroySingletons();
assertThat(rod6.destroyed).isTrue();
@ -967,7 +967,7 @@ class XmlBeanFactoryTests {
assertThat(rod9c.getAge()).isEqualTo(97);
ConstructorDependenciesBean rod10 = (ConstructorDependenciesBean) xbf.getBean("rod10");
assertThat(rod10.getName()).isEqualTo(null);
assertThat(rod10.getName()).isNull();
ConstructorDependenciesBean rod11 = (ConstructorDependenciesBean) xbf.getBean("rod11");
assertThat(rod11.getSpouse1()).isEqualTo(kerry2);
@ -1331,7 +1331,7 @@ class XmlBeanFactoryTests {
OverrideOneMethodSubclass ooms = (OverrideOneMethodSubclass) xbf.getBean("replaceVoidMethod");
DoSomethingReplacer dos = (DoSomethingReplacer) xbf.getBean("doSomethingReplacer");
assertThat(dos.lastArg).isEqualTo(null);
assertThat(dos.lastArg).isNull();
String s1 = "";
String s2 = "foo bar black sheep";
ooms.doSomething(s1);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -47,7 +47,7 @@ public class PrimitiveBeanLookupAndAutowiringTests {
public void primitiveLookupByName() {
ApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
boolean b = ctx.getBean("b", boolean.class);
assertThat(b).isEqualTo(true);
assertThat(b).isTrue();
int i = ctx.getBean("i", int.class);
assertThat(i).isEqualTo(42);
}
@ -56,7 +56,7 @@ public class PrimitiveBeanLookupAndAutowiringTests {
public void primitiveLookupByType() {
ApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
boolean b = ctx.getBean(boolean.class);
assertThat(b).isEqualTo(true);
assertThat(b).isTrue();
int i = ctx.getBean(int.class);
assertThat(i).isEqualTo(42);
}
@ -65,7 +65,7 @@ public class PrimitiveBeanLookupAndAutowiringTests {
public void primitiveAutowiredInjection() {
ApplicationContext ctx =
new AnnotationConfigApplicationContext(Config.class, AutowiredComponent.class);
assertThat(ctx.getBean(AutowiredComponent.class).b).isEqualTo(true);
assertThat(ctx.getBean(AutowiredComponent.class).b).isTrue();
assertThat(ctx.getBean(AutowiredComponent.class).i).isEqualTo(42);
}
@ -73,7 +73,7 @@ public class PrimitiveBeanLookupAndAutowiringTests {
public void primitiveResourceInjection() {
ApplicationContext ctx =
new AnnotationConfigApplicationContext(Config.class, ResourceComponent.class);
assertThat(ctx.getBean(ResourceComponent.class).b).isEqualTo(true);
assertThat(ctx.getBean(ResourceComponent.class).b).isTrue();
assertThat(ctx.getBean(ResourceComponent.class).i).isEqualTo(42);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -27,6 +27,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@ -43,7 +44,7 @@ public class CachedExpressionEvaluatorTests {
Method method = ReflectionUtils.findMethod(getClass(), "toString");
Expression expression = expressionEvaluator.getTestExpression("true", method, getClass());
hasParsedExpression("true");
assertThat(expression.getValue()).isEqualTo(true);
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
assertThat(expressionEvaluator.testCache.size()).as("Expression should be in cache").isEqualTo(1);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -25,6 +25,7 @@ import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
/**
* Unit tests for {@link MethodBasedEvaluationContext}.
@ -47,9 +48,9 @@ public class MethodBasedEvaluationContextTests {
assertThat(context.lookupVariable("p0")).isEqualTo("test");
assertThat(context.lookupVariable("foo")).isEqualTo("test");
assertThat(context.lookupVariable("a1")).isEqualTo(true);
assertThat(context.lookupVariable("p1")).isEqualTo(true);
assertThat(context.lookupVariable("flag")).isEqualTo(true);
assertThat(context.lookupVariable("a1")).asInstanceOf(BOOLEAN).isTrue();
assertThat(context.lookupVariable("p1")).asInstanceOf(BOOLEAN).isTrue();
assertThat(context.lookupVariable("flag")).asInstanceOf(BOOLEAN).isTrue();
assertThat(context.lookupVariable("a2")).isNull();
assertThat(context.lookupVariable("p2")).isNull();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -345,7 +345,7 @@ public class PropertySourcesPlaceholderConfigurerTests {
.addPropertyValue("jedi", "${jedi:false}")
.getBeanDefinition());
ppc.postProcessBeanFactory(bf);
assertThat(bf.getBean(TestBean.class).isJedi()).isEqualTo(true);
assertThat(bf.getBean(TestBean.class).isJedi()).isTrue();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -281,7 +281,7 @@ public class FormattingConversionServiceTests {
@Test
public void printNullDefault() {
assertThat(formattingService
.convert(null, TypeDescriptor.valueOf(Integer.class), TypeDescriptor.valueOf(String.class))).isEqualTo(null);
.convert(null, TypeDescriptor.valueOf(Integer.class), TypeDescriptor.valueOf(String.class))).isNull();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -42,7 +42,7 @@ public class JndiLocatorDelegateTests {
builderField.set(null, null);
try {
assertThat(JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable()).isEqualTo(false);
assertThat(JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable()).isFalse();
}
finally {
builderField.set(null, oldBuilder);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -57,7 +57,7 @@ public class ExecutorBeanDefinitionParserTests {
assertThat(getMaxPoolSize(executor)).isEqualTo(Integer.MAX_VALUE);
assertThat(getQueueCapacity(executor)).isEqualTo(Integer.MAX_VALUE);
assertThat(getKeepAliveSeconds(executor)).isEqualTo(60);
assertThat(getAllowCoreThreadTimeOut(executor)).isEqualTo(false);
assertThat(getAllowCoreThreadTimeOut(executor)).isFalse();
FutureTask<String> task = new FutureTask<>(new Callable<String>() {
@Override
@ -96,7 +96,7 @@ public class ExecutorBeanDefinitionParserTests {
assertThat(getCorePoolSize(executor)).isEqualTo(9);
assertThat(getMaxPoolSize(executor)).isEqualTo(9);
assertThat(getKeepAliveSeconds(executor)).isEqualTo(37);
assertThat(getAllowCoreThreadTimeOut(executor)).isEqualTo(true);
assertThat(getAllowCoreThreadTimeOut(executor)).isTrue();
assertThat(getQueueCapacity(executor)).isEqualTo(Integer.MAX_VALUE);
}
@ -106,7 +106,7 @@ public class ExecutorBeanDefinitionParserTests {
assertThat(getCorePoolSize(executor)).isEqualTo(123);
assertThat(getMaxPoolSize(executor)).isEqualTo(123);
assertThat(getKeepAliveSeconds(executor)).isEqualTo(60);
assertThat(getAllowCoreThreadTimeOut(executor)).isEqualTo(false);
assertThat(getAllowCoreThreadTimeOut(executor)).isFalse();
assertThat(getQueueCapacity(executor)).isEqualTo(Integer.MAX_VALUE);
}
@ -115,7 +115,7 @@ public class ExecutorBeanDefinitionParserTests {
Object executor = this.context.getBean("propertyPlaceholderWithRange");
assertThat(getCorePoolSize(executor)).isEqualTo(5);
assertThat(getMaxPoolSize(executor)).isEqualTo(25);
assertThat(getAllowCoreThreadTimeOut(executor)).isEqualTo(false);
assertThat(getAllowCoreThreadTimeOut(executor)).isFalse();
assertThat(getQueueCapacity(executor)).isEqualTo(10);
}
@ -124,7 +124,7 @@ public class ExecutorBeanDefinitionParserTests {
Object executor = this.context.getBean("propertyPlaceholderWithRangeAndCoreThreadTimeout");
assertThat(getCorePoolSize(executor)).isEqualTo(99);
assertThat(getMaxPoolSize(executor)).isEqualTo(99);
assertThat(getAllowCoreThreadTimeOut(executor)).isEqualTo(true);
assertThat(getAllowCoreThreadTimeOut(executor)).isTrue();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -1242,7 +1242,7 @@ class DataBinderTests {
assertThat(errors.getFieldError("name").getCodes()[2]).isEqualTo("NOT_ROD.java.lang.String");
assertThat(errors.getFieldError("name").getCodes()[3]).isEqualTo("NOT_ROD");
assertThat((errors.getFieldErrors("name").get(0)).getField()).isEqualTo("name");
assertThat((errors.getFieldErrors("name").get(0)).getRejectedValue()).isEqualTo(null);
assertThat((errors.getFieldErrors("name").get(0)).getRejectedValue()).isNull();
assertThat(errors.hasFieldErrors("spouse.age")).isTrue();
assertThat(errors.getFieldErrorCount("spouse.age")).isEqualTo(1);
@ -1314,7 +1314,7 @@ class DataBinderTests {
assertThat(errors.getFieldError("name").getCodes()[2]).isEqualTo("validation.NOT_ROD.java.lang.String");
assertThat(errors.getFieldError("name").getCodes()[3]).isEqualTo("validation.NOT_ROD");
assertThat((errors.getFieldErrors("name").get(0)).getField()).isEqualTo("name");
assertThat((errors.getFieldErrors("name").get(0)).getRejectedValue()).isEqualTo(null);
assertThat((errors.getFieldErrors("name").get(0)).getRejectedValue()).isNull();
assertThat(errors.hasFieldErrors("spouse.age")).isTrue();
assertThat(errors.getFieldErrorCount("spouse.age")).isEqualTo(1);
@ -1339,7 +1339,7 @@ class DataBinderTests {
assertThat(errors.getFieldErrorCount("spouse")).isEqualTo(1);
assertThat(errors.getFieldError("spouse").getCode()).isEqualTo("SPOUSE_NOT_AVAILABLE");
assertThat((errors.getFieldErrors("spouse").get(0)).getObjectName()).isEqualTo("tb");
assertThat((errors.getFieldErrors("spouse").get(0)).getRejectedValue()).isEqualTo(null);
assertThat((errors.getFieldErrors("spouse").get(0)).getRejectedValue()).isNull();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -71,8 +71,8 @@ class GenericTypeResolverTests {
void methodReturnTypes() {
assertThat(resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "integer"), MyInterfaceType.class)).isEqualTo(Integer.class);
assertThat(resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "string"), MyInterfaceType.class)).isEqualTo(String.class);
assertThat(resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "raw"), MyInterfaceType.class)).isEqualTo(null);
assertThat(resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "object"), MyInterfaceType.class)).isEqualTo(null);
assertThat(resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "raw"), MyInterfaceType.class)).isNull();
assertThat(resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "object"), MyInterfaceType.class)).isNull();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -370,9 +370,9 @@ class ReactiveAdapterRegistryTests {
@Test
void deferred() {
assertThat(getAdapter(CompletableFuture.class).getDescriptor().isDeferred()).isEqualTo(false);
assertThat(getAdapter(Deferred.class).getDescriptor().isDeferred()).isEqualTo(true);
assertThat(getAdapter(kotlinx.coroutines.flow.Flow.class).getDescriptor().isDeferred()).isEqualTo(true);
assertThat(getAdapter(CompletableFuture.class).getDescriptor().isDeferred()).isFalse();
assertThat(getAdapter(Deferred.class).getDescriptor().isDeferred()).isTrue();
assertThat(getAdapter(kotlinx.coroutines.flow.Flow.class).getDescriptor().isDeferred()).isTrue();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -60,8 +60,8 @@ class AnnotationAttributesTests {
assertThat(attributes.getString("name")).isEqualTo("dave");
assertThat(attributes.getStringArray("names")).isEqualTo(new String[] {"dave", "frank", "hal"});
assertThat(attributes.getBoolean("bool1")).isEqualTo(true);
assertThat(attributes.getBoolean("bool2")).isEqualTo(false);
assertThat(attributes.getBoolean("bool1")).isTrue();
assertThat(attributes.getBoolean("bool2")).isFalse();
assertThat(attributes.<Color>getEnum("color")).isEqualTo(Color.RED);
assertThat(attributes.getClass("class").equals(Integer.class)).isTrue();
assertThat(attributes.getClassArray("classes")).isEqualTo(new Class<?>[] {Number.class, Short.class, Integer.class});

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -79,7 +79,7 @@ class DefaultConversionServiceTests {
@Test
void stringToCharacterEmptyString() {
assertThat(conversionService.convert("", Character.class)).isEqualTo(null);
assertThat(conversionService.convert("", Character.class)).isNull();
}
@Test
@ -95,29 +95,29 @@ class DefaultConversionServiceTests {
@Test
void stringToBooleanTrue() {
assertThat(conversionService.convert("true", Boolean.class)).isEqualTo(true);
assertThat(conversionService.convert("on", Boolean.class)).isEqualTo(true);
assertThat(conversionService.convert("yes", Boolean.class)).isEqualTo(true);
assertThat(conversionService.convert("1", Boolean.class)).isEqualTo(true);
assertThat(conversionService.convert("TRUE", Boolean.class)).isEqualTo(true);
assertThat(conversionService.convert("ON", Boolean.class)).isEqualTo(true);
assertThat(conversionService.convert("YES", Boolean.class)).isEqualTo(true);
assertThat(conversionService.convert("true", Boolean.class)).isTrue();
assertThat(conversionService.convert("on", Boolean.class)).isTrue();
assertThat(conversionService.convert("yes", Boolean.class)).isTrue();
assertThat(conversionService.convert("1", Boolean.class)).isTrue();
assertThat(conversionService.convert("TRUE", Boolean.class)).isTrue();
assertThat(conversionService.convert("ON", Boolean.class)).isTrue();
assertThat(conversionService.convert("YES", Boolean.class)).isTrue();
}
@Test
void stringToBooleanFalse() {
assertThat(conversionService.convert("false", Boolean.class)).isEqualTo(false);
assertThat(conversionService.convert("off", Boolean.class)).isEqualTo(false);
assertThat(conversionService.convert("no", Boolean.class)).isEqualTo(false);
assertThat(conversionService.convert("0", Boolean.class)).isEqualTo(false);
assertThat(conversionService.convert("FALSE", Boolean.class)).isEqualTo(false);
assertThat(conversionService.convert("OFF", Boolean.class)).isEqualTo(false);
assertThat(conversionService.convert("NO", Boolean.class)).isEqualTo(false);
assertThat(conversionService.convert("false", Boolean.class)).isFalse();
assertThat(conversionService.convert("off", Boolean.class)).isFalse();
assertThat(conversionService.convert("no", Boolean.class)).isFalse();
assertThat(conversionService.convert("0", Boolean.class)).isFalse();
assertThat(conversionService.convert("FALSE", Boolean.class)).isFalse();
assertThat(conversionService.convert("OFF", Boolean.class)).isFalse();
assertThat(conversionService.convert("NO", Boolean.class)).isFalse();
}
@Test
void stringToBooleanEmptyString() {
assertThat(conversionService.convert("", Boolean.class)).isEqualTo(null);
assertThat(conversionService.convert("", Boolean.class)).isNull();
}
@Test
@ -219,7 +219,7 @@ class DefaultConversionServiceTests {
@Test
void stringToNumberEmptyString() {
assertThat(conversionService.convert("", Number.class)).isEqualTo(null);
assertThat(conversionService.convert("", Number.class)).isNull();
}
@Test
@ -234,7 +234,7 @@ class DefaultConversionServiceTests {
@Test
void stringToEnumEmptyString() {
assertThat(conversionService.convert("", Foo.class)).isEqualTo(null);
assertThat(conversionService.convert("", Foo.class)).isNull();
}
@Test
@ -254,7 +254,7 @@ class DefaultConversionServiceTests {
@Test
void integerToEnumNull() {
assertThat(conversionService.convert(null, Foo.class)).isEqualTo(null);
assertThat(conversionService.convert(null, Foo.class)).isNull();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -109,7 +109,7 @@ class GenericConversionServiceTests {
@Test
void convertNullSource() {
assertThat(conversionService.convert(null, Integer.class)).isEqualTo(null);
assertThat(conversionService.convert(null, Integer.class)).isNull();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -79,7 +79,7 @@ class PropertySourceTests {
PropertySource<?> ps1 = new MapPropertySource("ps1", map1);
ps1.getSource();
List<PropertySource<?>> propertySources = new ArrayList<>();
assertThat(propertySources.add(ps1)).isEqualTo(true);
assertThat(propertySources.add(ps1)).isTrue();
assertThat(propertySources.contains(ps1)).isTrue();
assertThat(propertySources.contains(PropertySource.named("ps1"))).isTrue();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -50,7 +50,7 @@ class SystemEnvironmentPropertySourceTests {
@Test
void none() {
assertThat(ps.containsProperty("a.key")).isEqualTo(false);
assertThat(ps.containsProperty("a.key")).isFalse();
assertThat(ps.getProperty("a.key")).isNull();
}
@ -58,7 +58,7 @@ class SystemEnvironmentPropertySourceTests {
void normalWithoutPeriod() {
envMap.put("akey", "avalue");
assertThat(ps.containsProperty("akey")).isEqualTo(true);
assertThat(ps.containsProperty("akey")).isTrue();
assertThat(ps.getProperty("akey")).isEqualTo("avalue");
}
@ -66,7 +66,7 @@ class SystemEnvironmentPropertySourceTests {
void normalWithPeriod() {
envMap.put("a.key", "a.value");
assertThat(ps.containsProperty("a.key")).isEqualTo(true);
assertThat(ps.containsProperty("a.key")).isTrue();
assertThat(ps.getProperty("a.key")).isEqualTo("a.value");
}
@ -74,8 +74,8 @@ class SystemEnvironmentPropertySourceTests {
void withUnderscore() {
envMap.put("a_key", "a_value");
assertThat(ps.containsProperty("a_key")).isEqualTo(true);
assertThat(ps.containsProperty("a.key")).isEqualTo(true);
assertThat(ps.containsProperty("a_key")).isTrue();
assertThat(ps.containsProperty("a.key")).isTrue();
assertThat(ps.getProperty("a_key")).isEqualTo("a_value");
assertThat( ps.getProperty("a.key")).isEqualTo("a_value");
@ -97,30 +97,30 @@ class SystemEnvironmentPropertySourceTests {
envMap.put("A_DOT.KEY", "a_dot_value");
envMap.put("A_HYPHEN-KEY", "a_hyphen_value");
assertThat(ps.containsProperty("A_KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A.KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A-KEY")).isEqualTo(true);
assertThat(ps.containsProperty("a_key")).isEqualTo(true);
assertThat(ps.containsProperty("a.key")).isEqualTo(true);
assertThat(ps.containsProperty("a-key")).isEqualTo(true);
assertThat(ps.containsProperty("A_LONG_KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A.LONG.KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A-LONG-KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A.LONG-KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A-LONG.KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A_long_KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A.long.KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A-long-KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A.long-KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A-long.KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A_DOT.KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A-DOT.KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A_dot.KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A-dot.KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A_HYPHEN-KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A.HYPHEN-KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A_hyphen-KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A.hyphen-KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A_KEY")).isTrue();
assertThat(ps.containsProperty("A.KEY")).isTrue();
assertThat(ps.containsProperty("A-KEY")).isTrue();
assertThat(ps.containsProperty("a_key")).isTrue();
assertThat(ps.containsProperty("a.key")).isTrue();
assertThat(ps.containsProperty("a-key")).isTrue();
assertThat(ps.containsProperty("A_LONG_KEY")).isTrue();
assertThat(ps.containsProperty("A.LONG.KEY")).isTrue();
assertThat(ps.containsProperty("A-LONG-KEY")).isTrue();
assertThat(ps.containsProperty("A.LONG-KEY")).isTrue();
assertThat(ps.containsProperty("A-LONG.KEY")).isTrue();
assertThat(ps.containsProperty("A_long_KEY")).isTrue();
assertThat(ps.containsProperty("A.long.KEY")).isTrue();
assertThat(ps.containsProperty("A-long-KEY")).isTrue();
assertThat(ps.containsProperty("A.long-KEY")).isTrue();
assertThat(ps.containsProperty("A-long.KEY")).isTrue();
assertThat(ps.containsProperty("A_DOT.KEY")).isTrue();
assertThat(ps.containsProperty("A-DOT.KEY")).isTrue();
assertThat(ps.containsProperty("A_dot.KEY")).isTrue();
assertThat(ps.containsProperty("A-dot.KEY")).isTrue();
assertThat(ps.containsProperty("A_HYPHEN-KEY")).isTrue();
assertThat(ps.containsProperty("A.HYPHEN-KEY")).isTrue();
assertThat(ps.containsProperty("A_hyphen-KEY")).isTrue();
assertThat(ps.containsProperty("A.hyphen-KEY")).isTrue();
assertThat(ps.getProperty("A_KEY")).isEqualTo("a_value");
assertThat(ps.getProperty("A.KEY")).isEqualTo("a_value");
@ -170,7 +170,7 @@ class SystemEnvironmentPropertySourceTests {
}
};
assertThat(ps.containsProperty("A_KEY")).isEqualTo(true);
assertThat(ps.containsProperty("A_KEY")).isTrue();
assertThat(ps.getProperty("A_KEY")).isEqualTo("a_value");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -124,37 +124,37 @@ class PathResourceTests {
@Test
void fileExists() {
PathResource resource = new PathResource(TEST_FILE);
assertThat(resource.exists()).isEqualTo(true);
assertThat(resource.exists()).isTrue();
}
@Test
void dirExists() {
PathResource resource = new PathResource(TEST_DIR);
assertThat(resource.exists()).isEqualTo(true);
assertThat(resource.exists()).isTrue();
}
@Test
void fileDoesNotExist() {
PathResource resource = new PathResource(NON_EXISTING_FILE);
assertThat(resource.exists()).isEqualTo(false);
assertThat(resource.exists()).isFalse();
}
@Test
void fileIsReadable() {
PathResource resource = new PathResource(TEST_FILE);
assertThat(resource.isReadable()).isEqualTo(true);
assertThat(resource.isReadable()).isTrue();
}
@Test
void doesNotExistIsNotReadable() {
PathResource resource = new PathResource(NON_EXISTING_FILE);
assertThat(resource.isReadable()).isEqualTo(false);
assertThat(resource.isReadable()).isFalse();
}
@Test
void directoryIsNotReadable() {
PathResource resource = new PathResource(TEST_DIR);
assertThat(resource.isReadable()).isEqualTo(false);
assertThat(resource.isReadable()).isFalse();
}
@Test
@ -256,13 +256,13 @@ class PathResourceTests {
@Test
void fileIsWritable() {
PathResource resource = new PathResource(TEST_FILE);
assertThat(resource.isWritable()).isEqualTo(true);
assertThat(resource.isWritable()).isTrue();
}
@Test
void directoryIsNotWritable() {
PathResource resource = new PathResource(TEST_DIR);
assertThat(resource.isWritable()).isEqualTo(false);
assertThat(resource.isWritable()).isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -115,7 +115,7 @@ class AnnotationMetadataTests {
assertThat(metadata.getAnnotationAttributes(MetaAnnotation.class.getName(), false)).isNull();
assertThat(metadata.getAnnotationAttributes(MetaAnnotation.class.getName(), true)).isNull();
assertThat(metadata.getAnnotatedMethods(DirectAnnotation.class.getName()).size()).isEqualTo(0);
assertThat(metadata.isAnnotated(IsAnnotatedAnnotation.class.getName())).isEqualTo(false);
assertThat(metadata.isAnnotated(IsAnnotatedAnnotation.class.getName())).isFalse();
assertThat(metadata.getAllAnnotationAttributes(DirectAnnotation.class.getName())).isNull();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -28,8 +28,8 @@ class PatternMatchUtilsTests {
@Test
void trivial() {
assertThat(PatternMatchUtils.simpleMatch((String) null, "")).isEqualTo(false);
assertThat(PatternMatchUtils.simpleMatch("1", null)).isEqualTo(false);
assertThat(PatternMatchUtils.simpleMatch((String) null, "")).isFalse();
assertThat(PatternMatchUtils.simpleMatch("1", null)).isFalse();
doTest("*", "123", true);
doTest("123", "123", true);
}

View File

@ -37,18 +37,18 @@ class StringUtilsTests {
@Test
void hasTextBlank() {
String blank = " ";
assertThat(StringUtils.hasText(blank)).isEqualTo(false);
assertThat(StringUtils.hasText(blank)).isFalse();
}
@Test
void hasTextNullEmpty() {
assertThat(StringUtils.hasText(null)).isEqualTo(false);
assertThat(StringUtils.hasText("")).isEqualTo(false);
assertThat(StringUtils.hasText(null)).isFalse();
assertThat(StringUtils.hasText("")).isFalse();
}
@Test
void hasTextValid() {
assertThat(StringUtils.hasText("t")).isEqualTo(true);
assertThat(StringUtils.hasText("t")).isTrue();
}
@Test
@ -68,7 +68,7 @@ class StringUtilsTests {
@Test
void trimWhitespace() {
assertThat(StringUtils.trimWhitespace(null)).isEqualTo(null);
assertThat(StringUtils.trimWhitespace(null)).isNull();
assertThat(StringUtils.trimWhitespace("")).isEqualTo("");
assertThat(StringUtils.trimWhitespace(" ")).isEqualTo("");
assertThat(StringUtils.trimWhitespace("\t")).isEqualTo("");
@ -83,7 +83,7 @@ class StringUtilsTests {
@Test
void trimAllWhitespace() {
assertThat(StringUtils.trimAllWhitespace(null)).isEqualTo(null);
assertThat(StringUtils.trimAllWhitespace(null)).isNull();
assertThat(StringUtils.trimAllWhitespace("")).isEqualTo("");
assertThat(StringUtils.trimAllWhitespace(" ")).isEqualTo("");
assertThat(StringUtils.trimAllWhitespace("\t")).isEqualTo("");
@ -98,7 +98,7 @@ class StringUtilsTests {
@Test
void trimLeadingWhitespace() {
assertThat(StringUtils.trimLeadingWhitespace(null)).isEqualTo(null);
assertThat(StringUtils.trimLeadingWhitespace(null)).isNull();
assertThat(StringUtils.trimLeadingWhitespace("")).isEqualTo("");
assertThat(StringUtils.trimLeadingWhitespace(" ")).isEqualTo("");
assertThat(StringUtils.trimLeadingWhitespace("\t")).isEqualTo("");
@ -113,7 +113,7 @@ class StringUtilsTests {
@Test
void trimTrailingWhitespace() {
assertThat(StringUtils.trimTrailingWhitespace(null)).isEqualTo(null);
assertThat(StringUtils.trimTrailingWhitespace(null)).isNull();
assertThat(StringUtils.trimTrailingWhitespace("")).isEqualTo("");
assertThat(StringUtils.trimTrailingWhitespace(" ")).isEqualTo("");
assertThat(StringUtils.trimTrailingWhitespace("\t")).isEqualTo("");
@ -128,7 +128,7 @@ class StringUtilsTests {
@Test
void trimLeadingCharacter() {
assertThat(StringUtils.trimLeadingCharacter(null, ' ')).isEqualTo(null);
assertThat(StringUtils.trimLeadingCharacter(null, ' ')).isNull();
assertThat(StringUtils.trimLeadingCharacter("", ' ')).isEqualTo("");
assertThat(StringUtils.trimLeadingCharacter(" ", ' ')).isEqualTo("");
assertThat(StringUtils.trimLeadingCharacter("\t", ' ')).isEqualTo("\t");
@ -141,7 +141,7 @@ class StringUtilsTests {
@Test
void trimTrailingCharacter() {
assertThat(StringUtils.trimTrailingCharacter(null, ' ')).isEqualTo(null);
assertThat(StringUtils.trimTrailingCharacter(null, ' ')).isNull();
assertThat(StringUtils.trimTrailingCharacter("", ' ')).isEqualTo("");
assertThat(StringUtils.trimTrailingCharacter(" ", ' ')).isEqualTo("");
assertThat(StringUtils.trimTrailingCharacter("\t", ' ')).isEqualTo("\t");
@ -340,7 +340,7 @@ class StringUtilsTests {
@Test
void getFilename() {
assertThat(StringUtils.getFilename(null)).isEqualTo(null);
assertThat(StringUtils.getFilename(null)).isNull();
assertThat(StringUtils.getFilename("")).isEqualTo("");
assertThat(StringUtils.getFilename("myfile")).isEqualTo("myfile");
assertThat(StringUtils.getFilename("mypath/myfile")).isEqualTo("myfile");
@ -352,11 +352,11 @@ class StringUtilsTests {
@Test
void getFilenameExtension() {
assertThat(StringUtils.getFilenameExtension(null)).isEqualTo(null);
assertThat(StringUtils.getFilenameExtension("")).isEqualTo(null);
assertThat(StringUtils.getFilenameExtension("myfile")).isEqualTo(null);
assertThat(StringUtils.getFilenameExtension("myPath/myfile")).isEqualTo(null);
assertThat(StringUtils.getFilenameExtension("/home/user/.m2/settings/myfile")).isEqualTo(null);
assertThat(StringUtils.getFilenameExtension(null)).isNull();
assertThat(StringUtils.getFilenameExtension("")).isNull();
assertThat(StringUtils.getFilenameExtension("myfile")).isNull();
assertThat(StringUtils.getFilenameExtension("myPath/myfile")).isNull();
assertThat(StringUtils.getFilenameExtension("/home/user/.m2/settings/myfile")).isNull();
assertThat(StringUtils.getFilenameExtension("myfile.")).isEqualTo("");
assertThat(StringUtils.getFilenameExtension("myPath/myfile.")).isEqualTo("");
assertThat(StringUtils.getFilenameExtension("myfile.txt")).isEqualTo("txt");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -64,7 +64,7 @@ public class ExpressionStateTests extends AbstractExpressionTests {
state.setLocalVariable("foo", null);
value = state.lookupLocalVariable("foo");
assertThat(value).isEqualTo(null);
assertThat(value).isNull();
}
@Test
@ -101,7 +101,7 @@ public class ExpressionStateTests extends AbstractExpressionTests {
@Test
public void testLocalVariableNestedScopes() {
ExpressionState state = getState();
assertThat(state.lookupLocalVariable("foo")).isEqualTo(null);
assertThat(state.lookupLocalVariable("foo")).isNull();
state.setLocalVariable("foo",12);
assertThat(state.lookupLocalVariable("foo")).isEqualTo(12);
@ -134,7 +134,7 @@ public class ExpressionStateTests extends AbstractExpressionTests {
((StandardEvaluationContext) state.getEvaluationContext()).setRootObject(null);
assertThat(state.getRootContextObject().getValue()).isEqualTo(null);
assertThat(state.getRootContextObject().getValue()).isNull();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -150,7 +150,7 @@ class IndexingTests {
assertThat(expression.getValueTypeDescriptor(this).toString()).isEqualTo("java.util.Map<java.lang.Integer, java.lang.Integer>");
assertThat(expression.getValue(this)).isEqualTo(property);
expression = parser.parseExpression("parameterizedMap['9']");
assertThat(expression.getValue(this)).isEqualTo(null);
assertThat(expression.getValue(this)).isNull();
expression.setValue(this, "37");
assertThat(expression.getValue(this)).isEqualTo(37);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -48,6 +48,7 @@ import org.springframework.expression.spel.testdata.PersonInOtherPackage;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.within;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
/**
* Checks SpelCompiler behavior. This should cover compilation all compiled node types.
@ -198,9 +199,9 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@Test
void operatorInstanceOf() {
expression = parse("'xyz' instanceof T(String)");
assertThat(expression.getValue()).isEqualTo(true);
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
assertCanCompile(expression);
assertThat(expression.getValue()).isEqualTo(true);
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
expression = parse("'xyz' instanceof T(Integer)");
assertThat(expression.getValue()).isEqualTo(false);
@ -209,21 +210,21 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
List<String> list = new ArrayList<>();
expression = parse("#root instanceof T(java.util.List)");
assertThat(expression.getValue(list)).isEqualTo(true);
assertThat(expression.getValue(list)).asInstanceOf(BOOLEAN).isTrue();
assertCanCompile(expression);
assertThat(expression.getValue(list)).isEqualTo(true);
assertThat(expression.getValue(list)).asInstanceOf(BOOLEAN).isTrue();
List<String>[] arrayOfLists = new List[] {new ArrayList<String>()};
expression = parse("#root instanceof T(java.util.List[])");
assertThat(expression.getValue(arrayOfLists)).isEqualTo(true);
assertThat(expression.getValue(arrayOfLists)).asInstanceOf(BOOLEAN).isTrue();
assertCanCompile(expression);
assertThat(expression.getValue(arrayOfLists)).isEqualTo(true);
assertThat(expression.getValue(arrayOfLists)).asInstanceOf(BOOLEAN).isTrue();
int[] intArray = new int[] {1,2,3};
expression = parse("#root instanceof T(int[])");
assertThat(expression.getValue(intArray)).isEqualTo(true);
assertThat(expression.getValue(intArray)).asInstanceOf(BOOLEAN).isTrue();
assertCanCompile(expression);
assertThat(expression.getValue(intArray)).isEqualTo(true);
assertThat(expression.getValue(intArray)).asInstanceOf(BOOLEAN).isTrue();
String root = null;
expression = parse("#root instanceof T(Integer)");
@ -239,18 +240,18 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
root = "howdy!";
expression = parse("#root instanceof T(java.lang.Object)");
assertThat(expression.getValue(root)).isEqualTo(true);
assertThat(expression.getValue(root)).asInstanceOf(BOOLEAN).isTrue();
assertCanCompile(expression);
assertThat(expression.getValue(root)).isEqualTo(true);
assertThat(expression.getValue(root)).asInstanceOf(BOOLEAN).isTrue();
}
@Test
void operatorInstanceOf_SPR14250() throws Exception {
// primitive left operand - should get boxed, return true
expression = parse("3 instanceof T(Integer)");
assertThat(expression.getValue()).isEqualTo(true);
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
assertCanCompile(expression);
assertThat(expression.getValue()).isEqualTo(true);
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
// primitive left operand - should get boxed, return false
expression = parse("3 instanceof T(String)");
@ -266,9 +267,9 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
// double slot left operand - should get boxed, return true
expression = parse("3.0d instanceof T(Double)");
assertThat(expression.getValue()).isEqualTo(true);
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
assertCanCompile(expression);
assertThat(expression.getValue()).isEqualTo(true);
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
// Only when the right hand operand is a direct type reference
// will it be compilable.
@ -646,9 +647,9 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertThat(expression.getValue()).isEqualTo(false);
expression = parse("!false");
assertThat(expression.getValue()).isEqualTo(true);
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
assertCanCompile(expression);
assertThat(expression.getValue()).isEqualTo(true);
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
boolean b = true;
expression = parse("!#root");
@ -658,9 +659,9 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
b = false;
expression = parse("!#root");
assertThat(expression.getValue(b)).isEqualTo(true);
assertThat(expression.getValue(b)).asInstanceOf(BOOLEAN).isTrue();
assertCanCompile(expression);
assertThat(expression.getValue(b)).isEqualTo(true);
assertThat(expression.getValue(b)).asInstanceOf(BOOLEAN).isTrue();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -28,6 +28,7 @@ import org.springframework.expression.spel.SpelParserConfiguration;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
/**
* Tests for the {@link SpelCompiler}.
@ -69,10 +70,10 @@ class SpelCompilerTests {
context.setVariable("user", new User());
expression = parser.parseExpression("#root.isEditable(#user)");
assertThat(SpelCompiler.compile(expression)).isFalse();
assertThat(expression.getValue(context)).isEqualTo(true);
assertThat(expression.getValue(context)).asInstanceOf(BOOLEAN).isTrue();
assertThat(SpelCompiler.compile(expression)).isTrue();
SpelCompilationCoverageTests.assertIsCompiled(expression);
assertThat(expression.getValue(context)).isEqualTo(true);
assertThat(expression.getValue(context)).asInstanceOf(BOOLEAN).isTrue();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -189,7 +189,7 @@ abstract class AbstractJmsAnnotationDrivenTests {
simpleFactory.getListenerContainer("first").getEndpoint();
assertThat(first.getId()).isEqualTo("first");
assertThat(first.getDestination()).isEqualTo("myQueue");
assertThat(first.getConcurrency()).isEqualTo(null);
assertThat(first.getConcurrency()).isNull();
MethodJmsListenerEndpoint second = (MethodJmsListenerEndpoint)
simpleFactory.getListenerContainer("second").getEndpoint();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -179,14 +179,14 @@ public class JmsListenerContainerFactoryTests {
assertThat(container.getConnectionFactory()).isEqualTo(this.connectionFactory);
assertThat(container.getDestinationResolver()).isEqualTo(this.destinationResolver);
assertThat(container.getMessageConverter()).isEqualTo(this.messageConverter);
assertThat(container.isSessionTransacted()).isEqualTo(true);
assertThat(container.isSessionTransacted()).isTrue();
assertThat(container.getSessionAcknowledgeMode()).isEqualTo(Session.DUPS_OK_ACKNOWLEDGE);
assertThat(container.isPubSubDomain()).isEqualTo(true);
assertThat(container.isReplyPubSubDomain()).isEqualTo(true);
assertThat(container.isPubSubDomain()).isTrue();
assertThat(container.isReplyPubSubDomain()).isTrue();
assertThat(container.getReplyQosSettings()).isEqualTo(new QosSettings(1, 7, 5000));
assertThat(container.isSubscriptionDurable()).isEqualTo(true);
assertThat(container.isSubscriptionDurable()).isTrue();
assertThat(container.getClientId()).isEqualTo("client-1234");
assertThat(container.isAutoStartup()).isEqualTo(false);
assertThat(container.isAutoStartup()).isFalse();
}
private void setDefaultJcaConfig(DefaultJcaListenerContainerFactory factory) {
@ -206,9 +206,9 @@ public class JmsListenerContainerFactoryTests {
JmsActivationSpecConfig config = container.getActivationSpecConfig();
assertThat(config).isNotNull();
assertThat(config.getAcknowledgeMode()).isEqualTo(Session.DUPS_OK_ACKNOWLEDGE);
assertThat(config.isPubSubDomain()).isEqualTo(true);
assertThat(config.isPubSubDomain()).isTrue();
assertThat(container.getReplyQosSettings()).isEqualTo(new QosSettings(1, 7, 5000));
assertThat(config.isSubscriptionDurable()).isEqualTo(true);
assertThat(config.isSubscriptionDurable()).isTrue();
assertThat(config.getClientId()).isEqualTo("client-1234");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -145,8 +145,8 @@ public class JmsNamespaceHandlerTests {
assertThat(container.getConnectionFactory()).as("explicit connection factory not set").isEqualTo(context.getBean(EXPLICIT_CONNECTION_FACTORY));
assertThat(container.getDestinationResolver()).as("explicit destination resolver not set").isEqualTo(context.getBean("testDestinationResolver"));
assertThat(container.getMessageConverter()).as("explicit message converter not set").isEqualTo(context.getBean("testMessageConverter"));
assertThat(container.isPubSubDomain()).as("Wrong pub/sub").isEqualTo(true);
assertThat(container.isSubscriptionDurable()).as("Wrong durable flag").isEqualTo(true);
assertThat(container.isPubSubDomain()).as("Wrong pub/sub").isTrue();
assertThat(container.isSubscriptionDurable()).as("Wrong durable flag").isTrue();
assertThat(container.getCacheLevel()).as("wrong cache").isEqualTo(DefaultMessageListenerContainer.CACHE_CONNECTION);
assertThat(container.getConcurrentConsumers()).as("wrong concurrency").isEqualTo(3);
assertThat(container.getMaxConcurrentConsumers()).as("wrong concurrency").isEqualTo(5);
@ -166,7 +166,7 @@ public class JmsNamespaceHandlerTests {
factory.createListenerContainer(createDummyEndpoint());
assertThat(container.getResourceAdapter()).as("explicit resource adapter not set").isEqualTo(context.getBean("testResourceAdapter"));
assertThat(container.getActivationSpecConfig().getMessageConverter()).as("explicit message converter not set").isEqualTo(context.getBean("testMessageConverter"));
assertThat(container.isPubSubDomain()).as("Wrong pub/sub").isEqualTo(true);
assertThat(container.isPubSubDomain()).as("Wrong pub/sub").isTrue();
assertThat(container.getActivationSpecConfig().getMaxConcurrency()).as("wrong concurrency").isEqualTo(5);
assertThat(container.getActivationSpecConfig().getPrefetchSize()).as("Wrong prefetch").isEqualTo(50);
assertThat(container.getPhase()).as("Wrong phase").isEqualTo(77);
@ -248,20 +248,20 @@ public class JmsNamespaceHandlerTests {
.getBean("listener1", DefaultMessageListenerContainer.class);
DefaultMessageListenerContainer listener2 = this.context
.getBean("listener2", DefaultMessageListenerContainer.class);
assertThat(listener1.isPubSubDomain()).as("Wrong destination type on listener1").isEqualTo(true);
assertThat(listener2.isPubSubDomain()).as("Wrong destination type on listener2").isEqualTo(true);
assertThat(listener1.isReplyPubSubDomain()).as("Wrong response destination type on listener1").isEqualTo(false);
assertThat(listener2.isReplyPubSubDomain()).as("Wrong response destination type on listener2").isEqualTo(false);
assertThat(listener1.isPubSubDomain()).as("Wrong destination type on listener1").isTrue();
assertThat(listener2.isPubSubDomain()).as("Wrong destination type on listener2").isTrue();
assertThat(listener1.isReplyPubSubDomain()).as("Wrong response destination type on listener1").isFalse();
assertThat(listener2.isReplyPubSubDomain()).as("Wrong response destination type on listener2").isFalse();
// JCA
JmsMessageEndpointManager listener3 = this.context
.getBean("listener3", JmsMessageEndpointManager.class);
JmsMessageEndpointManager listener4 = this.context
.getBean("listener4", JmsMessageEndpointManager.class);
assertThat(listener3.isPubSubDomain()).as("Wrong destination type on listener3").isEqualTo(true);
assertThat(listener4.isPubSubDomain()).as("Wrong destination type on listener4").isEqualTo(true);
assertThat(listener3.isReplyPubSubDomain()).as("Wrong response destination type on listener3").isEqualTo(false);
assertThat(listener4.isReplyPubSubDomain()).as("Wrong response destination type on listener4").isEqualTo(false);
assertThat(listener3.isPubSubDomain()).as("Wrong destination type on listener3").isTrue();
assertThat(listener4.isPubSubDomain()).as("Wrong destination type on listener4").isTrue();
assertThat(listener3.isReplyPubSubDomain()).as("Wrong response destination type on listener3").isFalse();
assertThat(listener4.isReplyPubSubDomain()).as("Wrong response destination type on listener4").isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -65,6 +65,7 @@ import org.springframework.validation.annotation.Validated;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@ -570,7 +571,7 @@ class MethodJmsListenerEndpointTests {
this.invocations.put("resolveJmsMessageHeaderAccessor", true);
assertThat(headers).as("MessageHeaders not injected").isNotNull();
assertThat(headers.getPriority()).as("Missing JMS message priority header").isEqualTo(Integer.valueOf(9));
assertThat(headers.getHeader("customBoolean")).as("Missing custom header").isEqualTo(true);
assertThat(headers.getHeader("customBoolean")).as("Missing custom header").asInstanceOf(BOOLEAN).isTrue();
}
public void resolveObjectPayload(MyBean bean) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -52,11 +52,11 @@ public class DefaultMessageListenerContainerTests {
DefaultMessageListenerContainer container = createContainer(createFailingContainerFactory());
container.setBackOff(backOff);
container.start();
assertThat(container.isRunning()).isEqualTo(true);
assertThat(container.isRunning()).isTrue();
container.refreshConnectionUntilSuccessful();
assertThat(container.isRunning()).isEqualTo(false);
assertThat(container.isRunning()).isFalse();
verify(backOff).start();
verify(execution).nextBackOff();
}
@ -73,7 +73,7 @@ public class DefaultMessageListenerContainerTests {
container.start();
container.refreshConnectionUntilSuccessful();
assertThat(container.isRunning()).isEqualTo(false);
assertThat(container.isRunning()).isFalse();
verify(backOff).start();
verify(execution, times(2)).nextBackOff();
}
@ -90,7 +90,7 @@ public class DefaultMessageListenerContainerTests {
container.start();
container.refreshConnectionUntilSuccessful();
assertThat(container.isRunning()).isEqualTo(true);
assertThat(container.isRunning()).isTrue();
verify(backOff).start();
verify(execution, times(1)).nextBackOff(); // only on attempt as the second one lead to a recovery
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -34,8 +34,8 @@ public class JmsMessageEndpointManagerTests {
JmsActivationSpecConfig config = new JmsActivationSpecConfig();
config.setPubSubDomain(false);
endpoint.setActivationSpecConfig(config);
assertThat(endpoint.isPubSubDomain()).isEqualTo(false);
assertThat(endpoint.isReplyPubSubDomain()).isEqualTo(false);
assertThat(endpoint.isPubSubDomain()).isFalse();
assertThat(endpoint.isReplyPubSubDomain()).isFalse();
}
@Test
@ -44,8 +44,8 @@ public class JmsMessageEndpointManagerTests {
JmsActivationSpecConfig config = new JmsActivationSpecConfig();
config.setPubSubDomain(true);
endpoint.setActivationSpecConfig(config);
assertThat(endpoint.isPubSubDomain()).isEqualTo(true);
assertThat(endpoint.isReplyPubSubDomain()).isEqualTo(true);
assertThat(endpoint.isPubSubDomain()).isTrue();
assertThat(endpoint.isReplyPubSubDomain()).isTrue();
}
@Test
@ -55,8 +55,8 @@ public class JmsMessageEndpointManagerTests {
config.setPubSubDomain(true);
config.setReplyPubSubDomain(false);
endpoint.setActivationSpecConfig(config);
assertThat(endpoint.isPubSubDomain()).isEqualTo(true);
assertThat(endpoint.isReplyPubSubDomain()).isEqualTo(false);
assertThat(endpoint.isPubSubDomain()).isTrue();
assertThat(endpoint.isReplyPubSubDomain()).isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -65,7 +65,7 @@ public class JmsMessageHeaderAccessorTests {
assertThat(headerAccessor.getMessageId()).isEqualTo("abcd-1234");
assertThat(headerAccessor.getPriority()).isEqualTo(Integer.valueOf(9));
assertThat(headerAccessor.getReplyTo()).isEqualTo(replyTo);
assertThat(headerAccessor.getRedelivered()).isEqualTo(true);
assertThat(headerAccessor.getRedelivered()).isTrue();
assertThat(headerAccessor.getType()).isEqualTo("type");
assertThat(headerAccessor.getTimestamp()).isEqualTo(4567);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -422,7 +422,7 @@ public class MessageBrokerConfigurationTests {
DefaultUserDestinationResolver resolver = context.getBean(DefaultUserDestinationResolver.class);
assertThat(resolver).isNotNull();
assertThat(resolver.isRemoveLeadingSlash()).isEqualTo(false);
assertThat(resolver.isRemoveLeadingSlash()).isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -98,8 +98,8 @@ public class ExecutorSubscribableChannelTests {
@Test
public void subscribeTwice() {
assertThat(this.channel.subscribe(this.handler)).isEqualTo(true);
assertThat(this.channel.subscribe(this.handler)).isEqualTo(false);
assertThat(this.channel.subscribe(this.handler)).isTrue();
assertThat(this.channel.subscribe(this.handler)).isFalse();
this.channel.send(this.message);
verify(this.handler, times(1)).handleMessage(this.message);
}
@ -107,8 +107,8 @@ public class ExecutorSubscribableChannelTests {
@Test
public void unsubscribeTwice() {
this.channel.subscribe(this.handler);
assertThat(this.channel.unsubscribe(this.handler)).isEqualTo(true);
assertThat(this.channel.unsubscribe(this.handler)).isEqualTo(false);
assertThat(this.channel.unsubscribe(this.handler)).isTrue();
assertThat(this.channel.unsubscribe(this.handler)).isFalse();
this.channel.send(this.message);
verify(this.handler, never()).handleMessage(this.message);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -322,8 +322,8 @@ class Jaxb2MarshallerTests extends AbstractMarshallerTests<Jaxb2Marshaller> {
verify(unmarshaller).unmarshal(sourceCaptor.capture());
SAXSource result = sourceCaptor.getValue();
assertThat(result.getXMLReader().getFeature("http://apache.org/xml/features/disallow-doctype-decl")).isEqualTo(true);
assertThat(result.getXMLReader().getFeature("http://xml.org/sax/features/external-general-entities")).isEqualTo(false);
assertThat(result.getXMLReader().getFeature("http://apache.org/xml/features/disallow-doctype-decl")).isTrue();
assertThat(result.getXMLReader().getFeature("http://xml.org/sax/features/external-general-entities")).isFalse();
// 2. external-general-entities and dtd support enabled
@ -335,8 +335,8 @@ class Jaxb2MarshallerTests extends AbstractMarshallerTests<Jaxb2Marshaller> {
verify(unmarshaller).unmarshal(sourceCaptor.capture());
result = sourceCaptor.getValue();
assertThat(result.getXMLReader().getFeature("http://apache.org/xml/features/disallow-doctype-decl")).isEqualTo(false);
assertThat(result.getXMLReader().getFeature("http://xml.org/sax/features/external-general-entities")).isEqualTo(true);
assertThat(result.getXMLReader().getFeature("http://apache.org/xml/features/disallow-doctype-decl")).isFalse();
assertThat(result.getXMLReader().getFeature("http://xml.org/sax/features/external-general-entities")).isTrue();
}
@Test // SPR-10806
@ -356,8 +356,8 @@ class Jaxb2MarshallerTests extends AbstractMarshallerTests<Jaxb2Marshaller> {
verify(unmarshaller).unmarshal(sourceCaptor.capture());
SAXSource result = sourceCaptor.getValue();
assertThat(result.getXMLReader().getFeature("http://apache.org/xml/features/disallow-doctype-decl")).isEqualTo(true);
assertThat(result.getXMLReader().getFeature("http://xml.org/sax/features/external-general-entities")).isEqualTo(false);
assertThat(result.getXMLReader().getFeature("http://apache.org/xml/features/disallow-doctype-decl")).isTrue();
assertThat(result.getXMLReader().getFeature("http://xml.org/sax/features/external-general-entities")).isFalse();
// 2. external-general-entities and dtd support enabled
@ -369,8 +369,8 @@ class Jaxb2MarshallerTests extends AbstractMarshallerTests<Jaxb2Marshaller> {
verify(unmarshaller).unmarshal(sourceCaptor.capture());
result = sourceCaptor.getValue();
assertThat(result.getXMLReader().getFeature("http://apache.org/xml/features/disallow-doctype-decl")).isEqualTo(false);
assertThat(result.getXMLReader().getFeature("http://xml.org/sax/features/external-general-entities")).isEqualTo(true);
assertThat(result.getXMLReader().getFeature("http://apache.org/xml/features/disallow-doctype-decl")).isFalse();
assertThat(result.getXMLReader().getFeature("http://xml.org/sax/features/external-general-entities")).isTrue();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -149,7 +149,7 @@ public class EventPublishingTestExecutionListenerIntegrationTests {
testContextManager.beforeTestMethod(testInstance, method);
assertThat(countDownLatch.await(2, TimeUnit.SECONDS)).isEqualTo(true);
assertThat(countDownLatch.await(2, TimeUnit.SECONDS)).isTrue();
verify(listener, only()).beforeTestMethod(testContext);
assertThat(TrackingAsyncUncaughtExceptionHandler.asyncException.getMessage())

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -175,7 +175,7 @@ class RegisterExtensionSpringExtensionTests {
@Test
void valueParameterFromDefaultValueForPropertyPlaceholder(@Value("${bogus:false}") Boolean defaultValue) {
assertThat(defaultValue).as("Default value should have been injected via @Value by Spring").isNotNull();
assertThat(defaultValue).as("default value").isEqualTo(false);
assertThat(defaultValue).as("default value").isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -169,7 +169,7 @@ class SpringExtensionTests {
@Test
void valueParameterFromDefaultValueForPropertyPlaceholder(@Value("${bogus:false}") Boolean defaultValue) {
assertThat(defaultValue).as("Default value should have been injected via @Value by Spring").isNotNull();
assertThat(defaultValue).as("default value").isEqualTo(false);
assertThat(defaultValue).as("default value").isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -155,7 +155,7 @@ class ReflectionTestUtilsTests {
assertThat(person.getName()).as("name (protected field)").isEqualTo("Tom");
assertThat(person.getAge()).as("age (private field)").isEqualTo(42);
assertThat(person.getEyeColor()).as("eye color (package private field)").isEqualTo("blue");
assertThat(person.likesPets()).as("'likes pets' flag (package private boolean field)").isEqualTo(true);
assertThat(person.likesPets()).as("'likes pets' flag (package private boolean field)").isTrue();
assertThat(person.getFavoriteNumber()).as("'favorite number' (package field)").isEqualTo(PI);
}
@ -167,7 +167,7 @@ class ReflectionTestUtilsTests {
assertThat(target.getName()).as("name (protected field)").isEqualTo("Tom");
assertThat(target.getAge()).as("age (private field)").isEqualTo(42);
assertThat(target.getEyeColor()).as("eye color (package private field)").isEqualTo("blue");
assertThat(target.likesPets()).as("'likes pets' flag (package private boolean field)").isEqualTo(true);
assertThat(target.likesPets()).as("'likes pets' flag (package private boolean field)").isTrue();
assertThat(target.getFavoriteNumber()).as("'favorite number' (package field)").isEqualTo(PI);
}
@ -260,7 +260,7 @@ class ReflectionTestUtilsTests {
assertThat(person.getName()).as("name (private method)").isEqualTo("Jerry");
assertThat(person.getAge()).as("age (protected method)").isEqualTo(33);
assertThat(person.getEyeColor()).as("eye color (package private method)").isEqualTo("green");
assertThat(person.likesPets()).as("'likes pets' flag (protected method for a boolean)").isEqualTo(false);
assertThat(person.likesPets()).as("'likes pets' flag (protected method for a boolean)").isFalse();
assertThat(person.getFavoriteNumber()).as("'favorite number' (protected method for a Number)").isEqualTo(Integer.valueOf(42));
assertThat(invokeGetterMethod(person, "getId")).isEqualTo(Long.valueOf(1));
@ -284,7 +284,7 @@ class ReflectionTestUtilsTests {
assertThat(person.getName()).as("name (private method)").isEqualTo("Tom");
assertThat(person.getAge()).as("age (protected method)").isEqualTo(42);
assertThat(person.getEyeColor()).as("eye color (package private method)").isEqualTo("blue");
assertThat(person.likesPets()).as("'likes pets' flag (protected method for a boolean)").isEqualTo(true);
assertThat(person.likesPets()).as("'likes pets' flag (protected method for a boolean)").isTrue();
assertThat(person.getFavoriteNumber()).as("'favorite number' (protected method for a Number)").isEqualTo(PI);
assertThat(invokeGetterMethod(person, "id")).isEqualTo(Long.valueOf(99));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -851,7 +851,7 @@ public class HtmlUnitRequestBuilderTests {
public void buildRequestSessionIsNew() throws Exception {
MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext);
assertThat(actualRequest.getSession().isNew()).isEqualTo(true);
assertThat(actualRequest.getSession().isNew()).isTrue();
}
@Test
@ -861,7 +861,7 @@ public class HtmlUnitRequestBuilderTests {
MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext);
assertThat(actualRequest.getSession().isNew()).isEqualTo(false);
assertThat(actualRequest.getSession().isNew()).isFalse();
}
@Test
@ -873,7 +873,7 @@ public class HtmlUnitRequestBuilderTests {
HttpSession sessionToRemove = actualRequest.getSession();
sessionToRemove.invalidate();
assertThat(sessions.containsKey(sessionToRemove.getId())).isEqualTo(false);
assertThat(sessions.containsKey(sessionToRemove.getId())).isFalse();
assertSingleSessionCookie("JSESSIONID=" + sessionToRemove.getId()
+ "; Expires=Thu, 01-Jan-1970 00:00:01 GMT; Path=/test; Domain=example.com");
@ -882,8 +882,8 @@ public class HtmlUnitRequestBuilderTests {
actualRequest = requestBuilder.buildRequest(servletContext);
assertThat(actualRequest.getSession().isNew()).isEqualTo(true);
assertThat(sessions.containsKey(sessionToRemove.getId())).isEqualTo(false);
assertThat(actualRequest.getSession().isNew()).isTrue();
assertThat(sessions.containsKey(sessionToRemove.getId())).isFalse();
}
// --- setContextPath

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -56,7 +56,7 @@ public class JtaTransactionManagerSerializationTests {
.getUserTransaction() == ut2).as("UserTransaction looked up on client").isTrue();
assertThat(serializedJtatm
.getTransactionManager()).as("TransactionManager didn't survive").isNull();
assertThat(serializedJtatm.isRollbackOnCommitFailure()).isEqualTo(true);
assertThat(serializedJtatm.isRollbackOnCommitFailure()).isTrue();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -323,7 +323,7 @@ class ServletWebRequestHttpMethodsTests {
assertThat(request.checkNotModified(oneMinuteAgo)).isFalse();
assertThat(servletResponse.getStatus()).isEqualTo(200);
assertThat(servletResponse.getHeader("Last-Modified")).isEqualTo(null);
assertThat(servletResponse.getHeader("Last-Modified")).isNull();
}
@ParameterizedHttpMethodTest
@ -337,7 +337,7 @@ class ServletWebRequestHttpMethodsTests {
assertThat(request.checkNotModified(currentEpoch)).isTrue();
assertThat(servletResponse.getStatus()).isEqualTo(412);
assertThat(servletResponse.getHeader("Last-Modified")).isEqualTo(null);
assertThat(servletResponse.getHeader("Last-Modified")).isNull();
}
private void setUpRequest(String method) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -287,8 +287,8 @@ public class CommonsMultipartResolverTests {
MultipartHttpServletRequest request) throws UnsupportedEncodingException {
MultipartTestBean1 mtb1 = new MultipartTestBean1();
assertThat(mtb1.getField1()).isEqualTo(null);
assertThat(mtb1.getField2()).isEqualTo(null);
assertThat(mtb1.getField1()).isNull();
assertThat(mtb1.getField2()).isNull();
ServletRequestDataBinder binder = new ServletRequestDataBinder(mtb1, "mybean");
binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor());
binder.bind(request);
@ -301,8 +301,8 @@ public class CommonsMultipartResolverTests {
assertThat(new String(mtb1.getField2())).isEqualTo(new String(file2.getBytes()));
MultipartTestBean2 mtb2 = new MultipartTestBean2();
assertThat(mtb2.getField1()).isEqualTo(null);
assertThat(mtb2.getField2()).isEqualTo(null);
assertThat(mtb2.getField1()).isNull();
assertThat(mtb2.getField2()).isNull();
binder = new ServletRequestDataBinder(mtb2, "mybean");
binder.registerCustomEditor(String.class, "field1", new StringMultipartFileEditor());
binder.registerCustomEditor(String.class, "field2", new StringMultipartFileEditor("UTF-16"));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -1066,7 +1066,7 @@ class UriComponentsBuilderTests {
assertThat(result1.getPath()).isEqualTo("/p1/%s/%s", vars.get("ps1"), vars.get("ps2"));
assertThat(result1.getQuery()).isEqualTo("q1");
assertThat(result1.getFragment()).isEqualTo("f1");
assertThat(result1.getSchemeSpecificPart()).isEqualTo(null);
assertThat(result1.getSchemeSpecificPart()).isNull();
UriComponents result2 = builder2.build();
assertThat(result2.getScheme()).isEqualTo("http");
@ -1075,7 +1075,7 @@ class UriComponentsBuilderTests {
assertThat(result2.getPath()).isEqualTo("/p1/%s/%s", vars.get("ps1"), vars.get("ps2"));
assertThat(result2.getQuery()).isEqualTo("q1");
assertThat(result2.getFragment()).isEqualTo("f1");
assertThat(result1.getSchemeSpecificPart()).isEqualTo(null);
assertThat(result1.getSchemeSpecificPart()).isNull();
}
@Test // gh-26466

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -60,7 +60,7 @@ public class CorsRegistryTests {
assertThat(config.getAllowedMethods()).isEqualTo(Collections.singletonList("DELETE"));
assertThat(config.getAllowedHeaders()).isEqualTo(Arrays.asList("header1", "header2"));
assertThat(config.getExposedHeaders()).isEqualTo(Arrays.asList("header3", "header4"));
assertThat(config.getAllowCredentials()).isEqualTo(false);
assertThat(config.getAllowCredentials()).isFalse();
assertThat(config.getMaxAge()).isEqualTo(Long.valueOf(3600));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -57,8 +57,8 @@ public class RequestMappingInfoTests {
PathPattern emptyPattern = (new PathPatternParser()).parse("");
assertThat(info.getPatternsCondition().getPatterns()).isEqualTo(Collections.singleton(emptyPattern));
assertThat(info.getMethodsCondition().getMethods().size()).isEqualTo(0);
assertThat(info.getConsumesCondition().isEmpty()).isEqualTo(true);
assertThat(info.getProducesCondition().isEmpty()).isEqualTo(true);
assertThat(info.getConsumesCondition().isEmpty()).isTrue();
assertThat(info.getProducesCondition().isEmpty()).isTrue();
assertThat(info.getParamsCondition()).isNotNull();
assertThat(info.getHeadersCondition()).isNotNull();
assertThat(info.getCustomCondition()).isNull();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -162,7 +162,7 @@ class GlobalCorsConfigIntegrationTests extends AbstractRequestMappingIntegration
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getHeaders().getAccessControlAllowOrigin()).isEqualTo("*");
assertThat(entity.getHeaders().getAccessControlAllowMethods()).containsExactly(HttpMethod.GET, HttpMethod.POST);
assertThat(entity.getHeaders().getAccessControlAllowCredentials()).isEqualTo(false);
assertThat(entity.getHeaders().getAccessControlAllowCredentials()).isFalse();
assertThat(entity.getHeaders().get(HttpHeaders.VARY))
.containsExactly(HttpHeaders.ORIGIN, HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD,
HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -38,6 +38,7 @@ import org.springframework.context.support.StaticApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
import static org.junit.jupiter.api.condition.JRE.JAVA_15;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
@ -99,7 +100,7 @@ public class ScriptTemplateViewTests {
assertThat(accessor.getPropertyValue("renderObject")).isEqualTo("Template");
assertThat(accessor.getPropertyValue("renderFunction")).isEqualTo("render");
assertThat(accessor.getPropertyValue("defaultCharset")).isEqualTo(StandardCharsets.ISO_8859_1);
assertThat(accessor.getPropertyValue("sharedEngine")).isEqualTo(true);
assertThat(accessor.getPropertyValue("sharedEngine")).asInstanceOf(BOOLEAN).isTrue();
}
@Test
@ -222,7 +223,7 @@ public class ScriptTemplateViewTests {
assertThat(engine2).isNotNull();
assertThat(accessor.getPropertyValue("renderObject")).isEqualTo("Template");
assertThat(accessor.getPropertyValue("renderFunction")).isEqualTo("render");
assertThat(accessor.getPropertyValue("sharedEngine")).isEqualTo(true);
assertThat(accessor.getPropertyValue("sharedEngine")).asInstanceOf(BOOLEAN).isTrue();
}
@SuppressWarnings("unchecked")
@ -241,7 +242,7 @@ public class ScriptTemplateViewTests {
assertThat(engine2).isNotNull();
assertThat(accessor.getPropertyValue("renderObject")).isEqualTo("Template");
assertThat(accessor.getPropertyValue("renderFunction")).isEqualTo("render");
assertThat(accessor.getPropertyValue("sharedEngine")).isEqualTo(false);
assertThat(accessor.getPropertyValue("sharedEngine")).asInstanceOf(BOOLEAN).isFalse();
}
private interface InvocableScriptEngine extends ScriptEngine, Invocable {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -50,6 +50,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ServletWebArgumentR
import org.springframework.web.util.UrlPathHelper;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
/**
* Test fixture for the configuration in mvc-config-annotation-driven.xml.
@ -73,7 +74,7 @@ public class AnnotationDrivenBeanDefinitionParserTests {
((ConfigurableWebBindingInitializer) initializer).getMessageCodesResolver();
assertThat(resolver).isNotNull();
assertThat(resolver.getClass()).isEqualTo(TestMessageCodesResolver.class);
assertThat(new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect")).isEqualTo(false);
assertThat(new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect")).asInstanceOf(BOOLEAN).isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -151,6 +151,7 @@ import org.springframework.web.util.UrlPathHelper;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
/**
* Tests loading actual MVC namespace configuration.
@ -212,7 +213,7 @@ public class MvcNamespaceTests {
RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class);
assertThat(adapter).isNotNull();
assertThat(new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect")).isEqualTo(false);
assertThat(new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect")).asInstanceOf(BOOLEAN).isFalse();
List<HttpMessageConverter<?>> converters = adapter.getMessageConverters();
assertThat(converters.size() > 0).isTrue();
@ -327,7 +328,7 @@ public class MvcNamespaceTests {
RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class);
assertThat(adapter).isNotNull();
assertThat(new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect")).isEqualTo(true);
assertThat(new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect")).asInstanceOf(BOOLEAN).isTrue();
// default web binding initializer behavior test
MockHttpServletRequest request = new MockHttpServletRequest();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -65,7 +65,7 @@ public class CorsRegistryTests {
assertThat(config.getAllowedMethods()).isEqualTo(Collections.singletonList("DELETE"));
assertThat(config.getAllowedHeaders()).isEqualTo(Arrays.asList("header1", "header2"));
assertThat(config.getExposedHeaders()).isEqualTo(Arrays.asList("header3", "header4"));
assertThat(config.getAllowCredentials()).isEqualTo(false);
assertThat(config.getAllowCredentials()).isFalse();
assertThat(config.getMaxAge()).isEqualTo(Long.valueOf(3600));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -245,9 +245,9 @@ public class DelegatingWebMvcConfigurationTests {
webMvcConfig.mvcResourceUrlProvider());
assertThat(annotationsMapping).isNotNull();
assertThat(annotationsMapping.useRegisteredSuffixPatternMatch()).isEqualTo(true);
assertThat(annotationsMapping.useSuffixPatternMatch()).isEqualTo(true);
assertThat(annotationsMapping.useTrailingSlashMatch()).isEqualTo(false);
assertThat(annotationsMapping.useRegisteredSuffixPatternMatch()).isTrue();
assertThat(annotationsMapping.useSuffixPatternMatch()).isTrue();
assertThat(annotationsMapping.useTrailingSlashMatch()).isFalse();
configAssertion.accept(annotationsMapping.getUrlPathHelper(), annotationsMapping.getPathMatcher());
SimpleUrlHandlerMapping mapping = (SimpleUrlHandlerMapping) webMvcConfig.viewControllerHandlerMapping(

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -89,6 +89,7 @@ import org.springframework.web.util.UrlPathHelper;
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static com.fasterxml.jackson.databind.MapperFeature.DEFAULT_VIEW_INCLUSION;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
import static org.mockito.Mockito.mock;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.springframework.http.MediaType.APPLICATION_XML;
@ -241,7 +242,7 @@ public class WebMvcConfigurationSupportExtensionTests {
(DeferredResultProcessingInterceptor[]) fieldAccessor.getPropertyValue("deferredResultInterceptors");
assertThat(deferredResultInterceptors.length).isEqualTo(1);
assertThat(fieldAccessor.getPropertyValue("ignoreDefaultModelOnRedirect")).isEqualTo(false);
assertThat(fieldAccessor.getPropertyValue("ignoreDefaultModelOnRedirect")).asInstanceOf(BOOLEAN).isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -158,7 +158,7 @@ public class CookieLocaleResolverTests {
Cookie cookie = response.getCookie(CookieLocaleResolver.DEFAULT_COOKIE_NAME);
assertThat(cookie).isNotNull();
assertThat(cookie.getName()).isEqualTo(CookieLocaleResolver.DEFAULT_COOKIE_NAME);
assertThat(cookie.getDomain()).isEqualTo(null);
assertThat(cookie.getDomain()).isNull();
assertThat(cookie.getPath()).isEqualTo(CookieLocaleResolver.DEFAULT_COOKIE_PATH);
assertThat(cookie.getSecure()).isFalse();
@ -244,7 +244,7 @@ public class CookieLocaleResolverTests {
Cookie cookie = response.getCookie(CookieLocaleResolver.DEFAULT_COOKIE_NAME);
assertThat(cookie).isNotNull();
assertThat(cookie.getName()).isEqualTo(CookieLocaleResolver.DEFAULT_COOKIE_NAME);
assertThat(cookie.getDomain()).isEqualTo(null);
assertThat(cookie.getDomain()).isNull();
assertThat(cookie.getPath()).isEqualTo(CookieLocaleResolver.DEFAULT_COOKIE_PATH);
assertThat(cookie.getSecure()).isFalse();
assertThat(cookie.getValue()).isEqualTo("de-AT");
@ -270,7 +270,7 @@ public class CookieLocaleResolverTests {
Cookie cookie = response.getCookie(CookieLocaleResolver.DEFAULT_COOKIE_NAME);
assertThat(cookie).isNotNull();
assertThat(cookie.getName()).isEqualTo(CookieLocaleResolver.DEFAULT_COOKIE_NAME);
assertThat(cookie.getDomain()).isEqualTo(null);
assertThat(cookie.getDomain()).isNull();
assertThat(cookie.getPath()).isEqualTo(CookieLocaleResolver.DEFAULT_COOKIE_PATH);
assertThat(cookie.getSecure()).isFalse();
assertThat(cookie.getValue()).isEqualTo("de_AT");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -63,8 +63,8 @@ class RequestMappingInfoTests {
assertThat(info.getMethodsCondition().getMethods().size()).isEqualTo(0);
assertThat(info.getParamsCondition()).isNotNull();
assertThat(info.getHeadersCondition()).isNotNull();
assertThat(info.getConsumesCondition().isEmpty()).isEqualTo(true);
assertThat(info.getProducesCondition().isEmpty()).isEqualTo(true);
assertThat(info.getConsumesCondition().isEmpty()).isTrue();
assertThat(info.getProducesCondition().isEmpty()).isTrue();
assertThat(info.getCustomCondition()).isNull();
RequestMappingInfo anotherInfo = infoBuilder.build();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -82,7 +82,7 @@ public class ExtendedServletRequestDataBinderTests {
WebDataBinder binder = new ExtendedServletRequestDataBinder(target, "");
((ServletRequestDataBinder) binder).bind(request);
assertThat(target.getName()).isEqualTo(null);
assertThat(target.getName()).isNull();
assertThat(target.getAge()).isEqualTo(0);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -139,7 +139,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
handler.handleReturnValue(mav, returnParamModelAndView, mavContainer, webRequest);
ModelMap model = mavContainer.getModel();
assertThat(mavContainer.getView()).isEqualTo(null);
assertThat(mavContainer.getView()).isNull();
assertThat(mavContainer.getModel().isEmpty()).isTrue();
assertThat(model).as("RedirectAttributes should not be used if controller doesn't redirect").isNotSameAs(redirectAttributes);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -247,7 +247,7 @@ public class RequestMappingHandlerAdapterTests {
assertThat(mav.getModel().get("attr1")).isEqualTo("lAttr1");
assertThat(mav.getModel().get("attr2")).isEqualTo("gAttr2");
assertThat(mav.getModel().get("attr3")).isEqualTo(null);
assertThat(mav.getModel().get("attr3")).isNull();
}
// SPR-10859

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -76,7 +76,7 @@ public class MappingJackson2JsonViewTests {
@Test
public void isExposePathVars() {
assertThat(view.isExposePathVariables()).as("Must not expose path variables").isEqualTo(false);
assertThat(view.isExposePathVariables()).as("Must not expose path variables").isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -47,6 +47,7 @@ import org.springframework.web.testfixture.servlet.MockServletContext;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
import static org.junit.jupiter.api.condition.JRE.JAVA_15;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
@ -113,7 +114,7 @@ public class ScriptTemplateViewTests {
assertThat(accessor.getPropertyValue("renderFunction")).isEqualTo("render");
assertThat(accessor.getPropertyValue("contentType")).isEqualTo(MediaType.TEXT_PLAIN_VALUE);
assertThat(accessor.getPropertyValue("charset")).isEqualTo(StandardCharsets.ISO_8859_1);
assertThat(accessor.getPropertyValue("sharedEngine")).isEqualTo(true);
assertThat(accessor.getPropertyValue("sharedEngine")).asInstanceOf(BOOLEAN).isTrue();
}
@Test
@ -301,7 +302,7 @@ public class ScriptTemplateViewTests {
assertThat(engine2).isNotNull();
assertThat(accessor.getPropertyValue("renderObject")).isEqualTo("Template");
assertThat(accessor.getPropertyValue("renderFunction")).isEqualTo("render");
assertThat(accessor.getPropertyValue("sharedEngine")).isEqualTo(true);
assertThat(accessor.getPropertyValue("sharedEngine")).asInstanceOf(BOOLEAN).isTrue();
}
@Test // gh-23258
@ -319,7 +320,7 @@ public class ScriptTemplateViewTests {
assertThat(engine2).isNotNull();
assertThat(accessor.getPropertyValue("renderObject")).isEqualTo("Template");
assertThat(accessor.getPropertyValue("renderFunction")).isEqualTo("render");
assertThat(accessor.getPropertyValue("sharedEngine")).isEqualTo(false);
assertThat(accessor.getPropertyValue("sharedEngine")).asInstanceOf(BOOLEAN).isFalse();
}
private interface InvocableScriptEngine extends ScriptEngine, Invocable {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -67,7 +67,7 @@ public class MappingJackson2XmlViewTests {
@Test
public void isExposePathVars() {
assertThat(view.isExposePathVariables()).as("Must not expose path variables").isEqualTo(false);
assertThat(view.isExposePathVariables()).as("Must not expose path variables").isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -66,12 +66,12 @@ public class MarshallingViewTests {
@Test
public void isExposePathVars() {
assertThat(view.isExposePathVariables()).as("Must not expose path variables").isEqualTo(false);
assertThat(view.isExposePathVariables()).as("Must not expose path variables").isFalse();
}
@Test
public void isExposePathVarsDefaultConstructor() {
assertThat(new MarshallingView().isExposePathVariables()).as("Must not expose path variables").isEqualTo(false);
assertThat(new MarshallingView().isExposePathVariables()).as("Must not expose path variables").isFalse();
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
@ -91,6 +91,7 @@ import org.springframework.web.testfixture.servlet.MockServletContext;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
/**
* Test fixture for {@link MessageBrokerBeanDefinitionParser}.
@ -128,7 +129,7 @@ public class MessageBrokerBeanDefinitionParserTests {
WebSocketSession session = new TestWebSocketSession("id");
wsHttpRequestHandler.getWebSocketHandler().afterConnectionEstablished(session);
assertThat(session.getAttributes().get("decorated")).isEqualTo(true);
assertThat(session.getAttributes().get("decorated")).asInstanceOf(BOOLEAN).isTrue();
WebSocketHandler wsHandler = wsHttpRequestHandler.getWebSocketHandler();
assertThat(wsHandler).isInstanceOf(ExceptionWebSocketHandlerDecorator.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -60,6 +60,7 @@ import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
import static org.mockito.Mockito.mock;
/**
@ -190,7 +191,7 @@ class WebSocketMessageBrokerConfigurationSupportTests {
WebSocketSession session = new TestWebSocketSession("id");
handler.afterConnectionEstablished(session);
assertThat(session.getAttributes().get("decorated")).isEqualTo(true);
assertThat(session.getAttributes().get("decorated")).asInstanceOf(BOOLEAN).isTrue();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -119,7 +119,7 @@ public class ClientSockJsSessionTests {
public void handleFrameMessageWithBadData() throws Exception {
this.session.handleFrame(SockJsFrame.openFrame().getContent());
this.session.handleFrame("a['bad data");
assertThat(this.session.isOpen()).isEqualTo(false);
assertThat(this.session.isOpen()).isFalse();
assertThat(this.session.disconnectStatus).isEqualTo(CloseStatus.BAD_DATA);
verify(this.handler).afterConnectionEstablished(this.session);
verifyNoMoreInteractions(this.handler);
@ -133,7 +133,7 @@ public class ClientSockJsSessionTests {
willThrow(new IllegalStateException("Fake error")).given(this.handler)
.handleMessage(this.session, new TextMessage("bar"));
this.session.handleFrame(SockJsFrame.messageFrame(CODEC, "foo", "bar").getContent());
assertThat(this.session.isOpen()).isEqualTo(true);
assertThat(this.session.isOpen()).isTrue();
verify(this.handler).afterConnectionEstablished(this.session);
verify(this.handler).handleMessage(this.session, new TextMessage("foo"));
verify(this.handler).handleMessage(this.session, new TextMessage("bar"));
@ -144,7 +144,7 @@ public class ClientSockJsSessionTests {
public void handleFrameClose() throws Exception {
this.session.handleFrame(SockJsFrame.openFrame().getContent());
this.session.handleFrame(SockJsFrame.closeFrame(1007, "").getContent());
assertThat(this.session.isOpen()).isEqualTo(false);
assertThat(this.session.isOpen()).isFalse();
assertThat(this.session.disconnectStatus).isEqualTo(new CloseStatus(1007, ""));
verify(this.handler).afterConnectionEstablished(this.session);
verifyNoMoreInteractions(this.handler);
@ -162,7 +162,7 @@ public class ClientSockJsSessionTests {
public void afterTransportClosed() throws Exception {
this.session.handleFrame(SockJsFrame.openFrame().getContent());
this.session.afterTransportClosed(CloseStatus.SERVER_ERROR);
assertThat(this.session.isOpen()).isEqualTo(false);
assertThat(this.session.isOpen()).isFalse();
verify(this.handler).afterConnectionEstablished(this.session);
verify(this.handler).afterConnectionClosed(this.session, CloseStatus.SERVER_ERROR);
verifyNoMoreInteractions(this.handler);
@ -172,7 +172,7 @@ public class ClientSockJsSessionTests {
public void close() throws Exception {
this.session.handleFrame(SockJsFrame.openFrame().getContent());
this.session.close();
assertThat(this.session.isOpen()).isEqualTo(false);
assertThat(this.session.isOpen()).isFalse();
assertThat(this.session.disconnectStatus).isEqualTo(CloseStatus.NORMAL);
verify(this.handler).afterConnectionEstablished(this.session);
verifyNoMoreInteractions(this.handler);