Skip to content

Commit d57bc17

Browse files
committed
Merge branch '5.3.x'
2 parents 4ebc53a + df263d0 commit d57bc17

File tree

72 files changed

+334
-322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+334
-322
lines changed

integration-tests/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ void succeedsWhenSubclassProxyAndScheduledMethodNotPresentOnInterface() throws I
7474

7575
MyRepository repository = ctx.getBean(MyRepository.class);
7676
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
77-
assertThat(AopUtils.isCglibProxy(repository)).isEqualTo(true);
77+
assertThat(AopUtils.isCglibProxy(repository)).isTrue();
7878
assertThat(repository.getInvocationCount()).isGreaterThan(0);
7979
assertThat(txManager.commits).isGreaterThan(0);
8080
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,15 +46,15 @@ public void testCustomEnumWithNull() {
4646
GenericBean<?> gb = new GenericBean<>();
4747
BeanWrapper bw = new BeanWrapperImpl(gb);
4848
bw.setPropertyValue("customEnum", null);
49-
assertThat(gb.getCustomEnum()).isEqualTo(null);
49+
assertThat(gb.getCustomEnum()).isNull();
5050
}
5151

5252
@Test
5353
public void testCustomEnumWithEmptyString() {
5454
GenericBean<?> gb = new GenericBean<>();
5555
BeanWrapper bw = new BeanWrapperImpl(gb);
5656
bw.setPropertyValue("customEnum", "");
57-
assertThat(gb.getCustomEnum()).isEqualTo(null);
57+
assertThat(gb.getCustomEnum()).isNull();
5858
}
5959

6060
@Test

spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -426,7 +426,7 @@ void nonStaticPrototypeFactoryMethodFoundByNonEagerTypeMatching() {
426426
assertThat(lbf.isTypeMatch("x1", Object.class)).isTrue();
427427
assertThat(lbf.isTypeMatch("&x1", Object.class)).isFalse();
428428
assertThat(lbf.getType("x1")).isEqualTo(TestBean.class);
429-
assertThat(lbf.getType("&x1")).isEqualTo(null);
429+
assertThat(lbf.getType("&x1")).isNull();
430430
assertThat(TestBeanFactory.initialized).isFalse();
431431

432432
lbf.registerAlias("x1", "x2");
@@ -2599,8 +2599,8 @@ public boolean postProcessAfterInstantiation(Object bean, String beanName) throw
25992599
void containsBeanReturnsTrueEvenForAbstractBeanDefinition() {
26002600
lbf.registerBeanDefinition("abs", BeanDefinitionBuilder
26012601
.rootBeanDefinition(TestBean.class).setAbstract(true).getBeanDefinition());
2602-
assertThat(lbf.containsBean("abs")).isEqualTo(true);
2603-
assertThat(lbf.containsBean("bogus")).isEqualTo(false);
2602+
assertThat(lbf.containsBean("abs")).isTrue();
2603+
assertThat(lbf.containsBean("bogus")).isFalse();
26042604
}
26052605

26062606
@Test

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -111,7 +111,7 @@ public void testPropertyOverrideConfigurer() {
111111

112112
assertThat(tb1.getAge()).isEqualTo(99);
113113
assertThat(tb2.getAge()).isEqualTo(99);
114-
assertThat(tb1.getName()).isEqualTo(null);
114+
assertThat(tb1.getName()).isNull();
115115
assertThat(tb2.getName()).isEqualTo("test");
116116
}
117117

@@ -310,7 +310,7 @@ public void testPropertyOverrideConfigurerWithIgnoreInvalidKeys() {
310310
TestBean tb2 = (TestBean) factory.getBean("tb2");
311311
assertThat(tb1.getAge()).isEqualTo(99);
312312
assertThat(tb2.getAge()).isEqualTo(99);
313-
assertThat(tb1.getName()).isEqualTo(null);
313+
assertThat(tb1.getName()).isNull();
314314
assertThat(tb2.getName()).isEqualTo("test");
315315
}
316316

@@ -423,7 +423,7 @@ private void doTestPropertyPlaceholderConfigurer(boolean parentChildSeparation)
423423
TestBean inner1 = (TestBean) tb2.getSomeMap().get("key3");
424424
TestBean inner2 = (TestBean) tb2.getSomeMap().get("mykey4");
425425
assertThat(inner1.getAge()).isEqualTo(0);
426-
assertThat(inner1.getName()).isEqualTo(null);
426+
assertThat(inner1.getName()).isNull();
427427
assertThat(inner1.getCountry()).isEqualTo(System.getProperty("os.name"));
428428
assertThat(inner2.getAge()).isEqualTo(98);
429429
assertThat(inner2.getName()).isEqualTo("namemyvarmyvar${");

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -100,17 +100,17 @@ public void testFactoryMethodsWithNullValue() {
100100

101101
FactoryMethods fm = (FactoryMethods) xbf.getBean("fullWithNull");
102102
assertThat(fm.getNum()).isEqualTo(27);
103-
assertThat(fm.getName()).isEqualTo(null);
103+
assertThat(fm.getName()).isNull();
104104
assertThat(fm.getTestBean().getName()).isEqualTo("Juergen");
105105

106106
fm = (FactoryMethods) xbf.getBean("fullWithGenericNull");
107107
assertThat(fm.getNum()).isEqualTo(27);
108-
assertThat(fm.getName()).isEqualTo(null);
108+
assertThat(fm.getName()).isNull();
109109
assertThat(fm.getTestBean().getName()).isEqualTo("Juergen");
110110

111111
fm = (FactoryMethods) xbf.getBean("fullWithNamedNull");
112112
assertThat(fm.getNum()).isEqualTo(27);
113-
assertThat(fm.getName()).isEqualTo(null);
113+
assertThat(fm.getName()).isNull();
114114
assertThat(fm.getTestBean().getName()).isEqualTo("Juergen");
115115
}
116116

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -342,7 +342,7 @@ public void testNestedInConstructor() {
342342
public void testLoadProperties() {
343343
Properties props = (Properties) this.beanFactory.getBean("myProperties");
344344
assertThat(props.get("foo")).as("Incorrect property value").isEqualTo("bar");
345-
assertThat(props.get("foo2")).as("Incorrect property value").isEqualTo(null);
345+
assertThat(props.get("foo2")).as("Incorrect property value").isNull();
346346
Properties props2 = (Properties) this.beanFactory.getBean("myProperties");
347347
assertThat(props == props2).isTrue();
348348
}
@@ -351,17 +351,17 @@ public void testLoadProperties() {
351351
public void testScopedProperties() {
352352
Properties props = (Properties) this.beanFactory.getBean("myScopedProperties");
353353
assertThat(props.get("foo")).as("Incorrect property value").isEqualTo("bar");
354-
assertThat(props.get("foo2")).as("Incorrect property value").isEqualTo(null);
354+
assertThat(props.get("foo2")).as("Incorrect property value").isNull();
355355
Properties props2 = (Properties) this.beanFactory.getBean("myScopedProperties");
356356
assertThat(props.get("foo")).as("Incorrect property value").isEqualTo("bar");
357-
assertThat(props.get("foo2")).as("Incorrect property value").isEqualTo(null);
357+
assertThat(props.get("foo2")).as("Incorrect property value").isNull();
358358
assertThat(props != props2).isTrue();
359359
}
360360

361361
@Test
362362
public void testLocalProperties() {
363363
Properties props = (Properties) this.beanFactory.getBean("myLocalProperties");
364-
assertThat(props.get("foo")).as("Incorrect property value").isEqualTo(null);
364+
assertThat(props.get("foo")).as("Incorrect property value").isNull();
365365
assertThat(props.get("foo2")).as("Incorrect property value").isEqualTo("bar2");
366366
}
367367

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -283,7 +283,7 @@ public void testPopulatedSet() throws Exception {
283283
Iterator it = hasMap.getSet().iterator();
284284
assertThat(it.next()).isEqualTo("bar");
285285
assertThat(it.next()).isEqualTo(jenny);
286-
assertThat(it.next()).isEqualTo(null);
286+
assertThat(it.next()).isNull();
287287
}
288288

289289
@Test

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -181,7 +181,7 @@ public void autoAliasing() {
181181
assertThat(beanNames.contains("aliasWithoutId3")).isFalse();
182182

183183
TestBean tb4 = (TestBean) getBeanFactory().getBean(TestBean.class.getName() + "#0");
184-
assertThat(tb4.getName()).isEqualTo(null);
184+
assertThat(tb4.getName()).isNull();
185185

186186
Map drs = getListableBeanFactory().getBeansOfType(DummyReferencer.class, false, false);
187187
assertThat(drs.size()).isEqualTo(5);

spring-context-support/src/test/java/org/springframework/cache/caffeine/CaffeineCacheTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -106,7 +106,7 @@ void testPutIfAbsentNullValue() {
106106
Cache.ValueWrapper wrapper = cache.putIfAbsent(key, "anotherValue");
107107
// A value is set but is 'null'
108108
assertThat(wrapper).isNotNull();
109-
assertThat(wrapper.get()).isEqualTo(null);
109+
assertThat(wrapper.get()).isNull();
110110
// not changed
111111
assertThat(cache.get(key).get()).isEqualTo(value);
112112
}

spring-context/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -196,7 +196,7 @@ void testHitMaxSizeLoadedFromContext() throws Exception {
196196
void testSetWhenExhaustedAction() {
197197
CommonsPool2TargetSource targetSource = new CommonsPool2TargetSource();
198198
targetSource.setBlockWhenExhausted(true);
199-
assertThat(targetSource.isBlockWhenExhausted()).isEqualTo(true);
199+
assertThat(targetSource.isBlockWhenExhausted()).isTrue();
200200
}
201201

202202
@Test

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -876,7 +876,7 @@ void autowireByConstructor() {
876876
// should have been autowired
877877
assertThat(rod1.getSpouse1()).isEqualTo(kerry);
878878
assertThat(rod1.getAge()).isEqualTo(0);
879-
assertThat(rod1.getName()).isEqualTo(null);
879+
assertThat(rod1.getName()).isNull();
880880

881881
ConstructorDependenciesBean rod2 = (ConstructorDependenciesBean) xbf.getBean("rod2");
882882
TestBean kerry1 = (TestBean) xbf.getBean("kerry1");
@@ -885,7 +885,7 @@ void autowireByConstructor() {
885885
assertThat(rod2.getSpouse1()).isEqualTo(kerry2);
886886
assertThat(rod2.getSpouse2()).isEqualTo(kerry1);
887887
assertThat(rod2.getAge()).isEqualTo(0);
888-
assertThat(rod2.getName()).isEqualTo(null);
888+
assertThat(rod2.getName()).isNull();
889889

890890
ConstructorDependenciesBean rod = (ConstructorDependenciesBean) xbf.getBean("rod3");
891891
IndexedTestBean other = (IndexedTestBean) xbf.getBean("other");
@@ -894,15 +894,15 @@ void autowireByConstructor() {
894894
assertThat(rod.getSpouse2()).isEqualTo(kerry);
895895
assertThat(rod.getOther()).isEqualTo(other);
896896
assertThat(rod.getAge()).isEqualTo(0);
897-
assertThat(rod.getName()).isEqualTo(null);
897+
assertThat(rod.getName()).isNull();
898898

899899
xbf.getBean("rod4", ConstructorDependenciesBean.class);
900900
// should have been autowired
901901
assertThat(rod.getSpouse1()).isEqualTo(kerry);
902902
assertThat(rod.getSpouse2()).isEqualTo(kerry);
903903
assertThat(rod.getOther()).isEqualTo(other);
904904
assertThat(rod.getAge()).isEqualTo(0);
905-
assertThat(rod.getName()).isEqualTo(null);
905+
assertThat(rod.getName()).isNull();
906906
}
907907

908908
@Test
@@ -929,7 +929,7 @@ void autowireByConstructorWithSimpleValues() {
929929
assertThat(rod6.getSpouse2()).isEqualTo(kerry1);
930930
assertThat(rod6.getOther()).isEqualTo(other);
931931
assertThat(rod6.getAge()).isEqualTo(0);
932-
assertThat(rod6.getName()).isEqualTo(null);
932+
assertThat(rod6.getName()).isNull();
933933

934934
xbf.destroySingletons();
935935
assertThat(rod6.destroyed).isTrue();
@@ -967,7 +967,7 @@ void constructorArgResolution() {
967967
assertThat(rod9c.getAge()).isEqualTo(97);
968968

969969
ConstructorDependenciesBean rod10 = (ConstructorDependenciesBean) xbf.getBean("rod10");
970-
assertThat(rod10.getName()).isEqualTo(null);
970+
assertThat(rod10.getName()).isNull();
971971

972972
ConstructorDependenciesBean rod11 = (ConstructorDependenciesBean) xbf.getBean("rod11");
973973
assertThat(rod11.getSpouse1()).isEqualTo(kerry2);
@@ -1331,7 +1331,7 @@ void replaceMethodOverrideWithSetterInjection() {
13311331

13321332
OverrideOneMethodSubclass ooms = (OverrideOneMethodSubclass) xbf.getBean("replaceVoidMethod");
13331333
DoSomethingReplacer dos = (DoSomethingReplacer) xbf.getBean("doSomethingReplacer");
1334-
assertThat(dos.lastArg).isEqualTo(null);
1334+
assertThat(dos.lastArg).isNull();
13351335
String s1 = "";
13361336
String s2 = "foo bar black sheep";
13371337
ooms.doSomething(s1);

spring-context/src/test/java/org/springframework/context/annotation/PrimitiveBeanLookupAndAutowiringTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class PrimitiveBeanLookupAndAutowiringTests {
4646
public void primitiveLookupByName() {
4747
ApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
4848
boolean b = ctx.getBean("b", boolean.class);
49-
assertThat(b).isEqualTo(true);
49+
assertThat(b).isTrue();
5050
int i = ctx.getBean("i", int.class);
5151
assertThat(i).isEqualTo(42);
5252
}
@@ -55,7 +55,7 @@ public void primitiveLookupByName() {
5555
public void primitiveLookupByType() {
5656
ApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
5757
boolean b = ctx.getBean(boolean.class);
58-
assertThat(b).isEqualTo(true);
58+
assertThat(b).isTrue();
5959
int i = ctx.getBean(int.class);
6060
assertThat(i).isEqualTo(42);
6161
}
@@ -64,15 +64,15 @@ public void primitiveLookupByType() {
6464
public void primitiveAutowiredInjection() {
6565
ApplicationContext ctx =
6666
new AnnotationConfigApplicationContext(Config.class, AutowiredComponent.class);
67-
assertThat(ctx.getBean(AutowiredComponent.class).b).isEqualTo(true);
67+
assertThat(ctx.getBean(AutowiredComponent.class).b).isTrue();
6868
assertThat(ctx.getBean(AutowiredComponent.class).i).isEqualTo(42);
6969
}
7070

7171
@Test
7272
public void primitiveResourceInjection() {
7373
ApplicationContext ctx =
7474
new AnnotationConfigApplicationContext(Config.class, ResourceComponent.class);
75-
assertThat(ctx.getBean(ResourceComponent.class).b).isEqualTo(true);
75+
assertThat(ctx.getBean(ResourceComponent.class).b).isTrue();
7676
assertThat(ctx.getBean(ResourceComponent.class).i).isEqualTo(42);
7777
}
7878

spring-context/src/test/java/org/springframework/context/expression/CachedExpressionEvaluatorTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
2727
import org.springframework.util.ReflectionUtils;
2828

2929
import static org.assertj.core.api.Assertions.assertThat;
30+
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
3031
import static org.mockito.Mockito.spy;
3132
import static org.mockito.Mockito.times;
3233
import static org.mockito.Mockito.verify;
@@ -43,7 +44,7 @@ public void parseNewExpression() {
4344
Method method = ReflectionUtils.findMethod(getClass(), "toString");
4445
Expression expression = expressionEvaluator.getTestExpression("true", method, getClass());
4546
hasParsedExpression("true");
46-
assertThat(expression.getValue()).isEqualTo(true);
47+
assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue();
4748
assertThat(expressionEvaluator.testCache.size()).as("Expression should be in cache").isEqualTo(1);
4849
}
4950

spring-context/src/test/java/org/springframework/context/expression/MethodBasedEvaluationContextTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
2525
import org.springframework.util.ReflectionUtils;
2626

2727
import static org.assertj.core.api.Assertions.assertThat;
28+
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
2829

2930
/**
3031
* Unit tests for {@link MethodBasedEvaluationContext}.
@@ -47,9 +48,9 @@ public void simpleArguments() {
4748
assertThat(context.lookupVariable("p0")).isEqualTo("test");
4849
assertThat(context.lookupVariable("foo")).isEqualTo("test");
4950

50-
assertThat(context.lookupVariable("a1")).isEqualTo(true);
51-
assertThat(context.lookupVariable("p1")).isEqualTo(true);
52-
assertThat(context.lookupVariable("flag")).isEqualTo(true);
51+
assertThat(context.lookupVariable("a1")).asInstanceOf(BOOLEAN).isTrue();
52+
assertThat(context.lookupVariable("p1")).asInstanceOf(BOOLEAN).isTrue();
53+
assertThat(context.lookupVariable("flag")).asInstanceOf(BOOLEAN).isTrue();
5354

5455
assertThat(context.lookupVariable("a2")).isNull();
5556
assertThat(context.lookupVariable("p2")).isNull();

0 commit comments

Comments
 (0)