Skip to content

Commit a738112

Browse files
add javadoc and update tests for Strings.isBlank
1 parent 99980be commit a738112

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

internal-api/src/main/java/datadog/trace/util/Strings.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ public static boolean isNotBlank(String s) {
194194
return false;
195195
}
196196

197+
/**
198+
* Checks that a string is blank, i.e. doest not contain characters or is null
199+
*
200+
* @param s The string to be checked
201+
* @return {@code true} if string is blank (string is {@code null}, empty, or contains only
202+
* whitespace characters), {@code false} otherwise
203+
*/
197204
public static boolean isBlank(String s) {
198205
return !isNotBlank(s);
199206
}

internal-api/src/test/groovy/datadog/trace/util/StringsTest.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,14 @@ class StringsTest extends DDSpecification {
117117
"hélló wórld" | 5 | "hélló"
118118
}
119119

120-
def "test isNotBlank: #input"() {
120+
def "test isNotBlank and isBlank: #input"() {
121121
when:
122122
def notBlank = Strings.isNotBlank(input)
123+
def isBlank = Strings.isBlank(input)
123124

124125
then:
125126
notBlank == expected
127+
isBlank == !notBlank
126128

127129
where:
128130
input | expected

0 commit comments

Comments
 (0)