From 6c2cb8ecf5d1d755f09aff80489aa8b6e49d70b1 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 14 Jan 2020 17:33:02 +0100 Subject: [PATCH] Polish contribution See gh-24351 --- .../org/springframework/util/StringUtilsTests.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 e1f3ecef57b..9191b3f79df 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(); } + }