Skip to content

Commit 2a80b64

Browse files
springmonstersbrannen
authored andcommitted
Add tests for StringUtils matchesCharacter() method
Closes gh-27909
1 parent e24043a commit 2a80b64

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -152,6 +152,14 @@ void trimTrailingCharacter() {
152152
assertThat(StringUtils.trimTrailingCharacter(" a b c ", ' ')).isEqualTo(" a b c");
153153
}
154154

155+
@Test
156+
void matchesCharacter() {
157+
assertThat(StringUtils.matchesCharacter(null, '/')).isFalse();
158+
assertThat(StringUtils.matchesCharacter("/a", '/')).isFalse();
159+
assertThat(StringUtils.matchesCharacter("a", '/')).isFalse();
160+
assertThat(StringUtils.matchesCharacter("/", '/')).isTrue();
161+
}
162+
155163
@Test
156164
void startsWithIgnoreCase() {
157165
String prefix = "fOo";

0 commit comments

Comments
 (0)