Browse Source

Remove flaky assertion to fix build on JDK 17

Sometime between JDK 8 and JDK 17, the behavior for List::toArray()
changed. Specifically, the type returned for List<String> changed from
String[] to Object[].

This commit therefore removes an assertion against this particular
JDK-specific behavior. The affected test method retains additional
assertions along the same lines but which are not flaky.
pull/33756/head
Sam Brannen 3 years ago
parent
commit
423f2215c2
  1. 1
      spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java

1
spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java

@ -919,7 +919,6 @@ class ObjectUtilsTests { @@ -919,7 +919,6 @@ class ObjectUtilsTests {
void nullSafeConciseToStringForArraysAndCollections() {
List<String> list = Arrays.asList("a", "b", "c");
assertThat(ObjectUtils.nullSafeConciseToString(new int[][] {{1, 2}, {3, 4}})).startsWith(prefix(int[][].class));
assertThat(ObjectUtils.nullSafeConciseToString(list.toArray())).startsWith(prefix(String[].class));
assertThat(ObjectUtils.nullSafeConciseToString(list.toArray(new Object[0]))).startsWith(prefix(Object[].class));
assertThat(ObjectUtils.nullSafeConciseToString(list.toArray(new String[0]))).startsWith(prefix(String[].class));
assertThat(ObjectUtils.nullSafeConciseToString(new ArrayList<>(list))).startsWith(prefix(ArrayList.class));

Loading…
Cancel
Save