diff --git a/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java b/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java index e1f3ecef57..9191b3f79d 100644 --- a/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -747,18 +747,19 @@ class StringUtilsTests { @Test void split() { - assertThat(StringUtils.split("Hello, world", ",")).isEqualTo(new String[]{"Hello", " world"}); - assertThat(StringUtils.split(",Hello world", ",")).isEqualTo(new String[]{"", "Hello world"}); - assertThat(StringUtils.split("Hello world,", ",")).isEqualTo(new String[]{"Hello world", ""}); - assertThat(StringUtils.split("Hello, world,", ",")).isEqualTo(new String[]{"Hello", " world,"}); + assertThat(StringUtils.split("Hello, world", ",")).containsExactly("Hello", " world"); + assertThat(StringUtils.split(",Hello world", ",")).containsExactly("", "Hello world"); + assertThat(StringUtils.split("Hello world,", ",")).containsExactly("Hello world", ""); + assertThat(StringUtils.split("Hello, world,", ",")).containsExactly("Hello", " world,"); } @Test - void splitWithEmptyString() { + void splitWithEmptyStringOrNull() { assertThat(StringUtils.split("Hello, world", "")).isNull(); assertThat(StringUtils.split("", ",")).isNull(); assertThat(StringUtils.split(null, ",")).isNull(); assertThat(StringUtils.split("Hello, world", null)).isNull(); assertThat(StringUtils.split(null, null)).isNull(); } + }