Skip to content

Commit 2cd1ee8

Browse files
zinzoddarisbrannen
authored andcommitted
Add unit tests for StringUtils.hasLength()
Closes gh-33658
1 parent 1016743 commit 2cd1ee8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spring-core/src/test/java/org/springframework/util/StringUtilsTests.java

+17
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@
3636
*/
3737
class StringUtilsTests {
3838

39+
@Test
40+
void hasLengthBlank() {
41+
String blank = " ";
42+
assertThat(StringUtils.hasLength(blank)).isTrue();
43+
}
44+
45+
@Test
46+
void hasLengthNullEmpty() {
47+
assertThat(StringUtils.hasLength(null)).isFalse();
48+
assertThat(StringUtils.hasLength("")).isFalse();
49+
}
50+
51+
@Test
52+
void hasLengthValid() {
53+
assertThat(StringUtils.hasLength("t")).isTrue();
54+
}
55+
3956
@Test
4057
void hasTextBlank() {
4158
String blank = " ";

0 commit comments

Comments
 (0)