Polish contribution

See gh-24351
This commit is contained in:
Sam Brannen 2020-01-14 17:33:02 +01:00
parent f1827cb1f9
commit 6c2cb8ecf5
1 changed files with 7 additions and 6 deletions

View File

@ -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();
}
}