Skip to content

Commit f26a7de

Browse files
committed
Fix broken tests, update copyright dates, and polish
See gh-29414
1 parent b2c8546 commit f26a7de

File tree

23 files changed

+87
-148
lines changed

23 files changed

+87
-148
lines changed

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

Lines changed: 1 addition & 1 deletion
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.

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.time.DayOfWeek;
2929
import java.time.LocalDateTime;
3030
import java.util.ArrayList;
31-
import java.util.Arrays;
3231
import java.util.Date;
3332
import java.util.List;
3433
import java.util.Locale;
@@ -227,16 +226,16 @@ void copyPropertiesHonorsGenericTypeMatchesFromIntegerToInteger() {
227226
IntegerListHolder2 integerListHolder2 = new IntegerListHolder2();
228227

229228
BeanUtils.copyProperties(integerListHolder1, integerListHolder2);
230-
assertThat(integerListHolder1.getList()).containsOnly(42);
231-
assertThat(integerListHolder2.getList()).containsOnly(42);
229+
assertThat(integerListHolder1.getList()).containsExactly(42);
230+
assertThat(integerListHolder2.getList()).containsExactly(42);
232231
}
233232

234233
/**
235234
* {@code List<?>} can be copied to {@code List<?>}.
236235
*/
237236
@Test
238237
void copyPropertiesHonorsGenericTypeMatchesFromWildcardToWildcard() {
239-
List<?> list = Arrays.asList("foo", 42);
238+
List<?> list = List.of("foo", 42);
240239
WildcardListHolder1 wildcardListHolder1 = new WildcardListHolder1();
241240
wildcardListHolder1.setList(list);
242241
WildcardListHolder2 wildcardListHolder2 = new WildcardListHolder2();
@@ -257,8 +256,8 @@ void copyPropertiesHonorsGenericTypeMatchesFromIntegerToWildcard() {
257256
WildcardListHolder2 wildcardListHolder2 = new WildcardListHolder2();
258257

259258
BeanUtils.copyProperties(integerListHolder1, wildcardListHolder2);
260-
assertThat(integerListHolder1.getList()).containsOnly(42);
261-
assertThat(wildcardListHolder2.getList()).isEqualTo(Arrays.asList(42));
259+
assertThat(integerListHolder1.getList()).containsExactly(42);
260+
assertThat(wildcardListHolder2.getList()).isEqualTo(List.of(42));
262261
}
263262

264263
/**
@@ -271,9 +270,8 @@ void copyPropertiesHonorsGenericTypeMatchesForUpperBoundedWildcard() {
271270
NumberUpperBoundedWildcardListHolder numberListHolder = new NumberUpperBoundedWildcardListHolder();
272271

273272
BeanUtils.copyProperties(integerListHolder1, numberListHolder);
274-
assertThat(integerListHolder1.getList()).containsOnly(42);
275-
assertThat(numberListHolder.getList()).hasSize(1);
276-
assertThat(numberListHolder.getList().contains(42)).isTrue();
273+
assertThat(integerListHolder1.getList()).containsExactly(42);
274+
assertThat(numberListHolder.getList()).isEqualTo(List.of(42));
277275
}
278276

279277
/**
@@ -300,7 +298,7 @@ void copyPropertiesDoesNotHonorGenericTypeMismatches() {
300298
LongListHolder longListHolder = new LongListHolder();
301299

302300
BeanUtils.copyProperties(integerListHolder, longListHolder);
303-
assertThat(integerListHolder.getList()).containsOnly(42);
301+
assertThat(integerListHolder.getList()).containsExactly(42);
304302
assertThat(longListHolder.getList()).isEmpty();
305303
}
306304

@@ -314,13 +312,13 @@ void copyPropertiesDoesNotHonorGenericTypeMismatchesFromSubTypeToSuperType() {
314312
NumberListHolder numberListHolder = new NumberListHolder();
315313

316314
BeanUtils.copyProperties(integerListHolder, numberListHolder);
317-
assertThat(integerListHolder.getList()).containsOnly(42);
315+
assertThat(integerListHolder.getList()).containsExactly(42);
318316
assertThat(numberListHolder.getList()).isEmpty();
319317
}
320318

321319
@Test // gh-26531
322320
void copyPropertiesIgnoresGenericsIfSourceOrTargetHasUnresolvableGenerics() throws Exception {
323-
Order original = new Order("test", Arrays.asList("foo", "bar"));
321+
Order original = new Order("test", List.of("foo", "bar"));
324322

325323
// Create a Proxy that loses the generic type information for the getLineItems() method.
326324
OrderSummary proxy = proxyOrder(original);

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

Lines changed: 1 addition & 1 deletion
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.

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

Lines changed: 1 addition & 1 deletion
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.

spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java

Lines changed: 1 addition & 1 deletion
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.

spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/TestBean.java

Lines changed: 1 addition & 1 deletion
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.

spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.java

Lines changed: 1 addition & 1 deletion
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.

spring-context/src/test/java/org/springframework/scripting/config/ScriptingDefaultsTests.java

Lines changed: 1 addition & 1 deletion
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.

spring-core/src/test/java/org/springframework/core/ConstantsTests.java

Lines changed: 1 addition & 1 deletion
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.

spring-core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java

Lines changed: 1 addition & 1 deletion
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.

0 commit comments

Comments
 (0)