Skip to content

Commit

Permalink
added checking for empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
xuelianhan007 committed Dec 23, 2024
1 parent d67bdf4 commit b3427f4
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ default boolean checkExpectNotBlank(PathCheck pathCheck, Object variable) {

default boolean checkExpectString(PathCheck pathCheck, Object variable) {
Class<?> dataType = whichDataTypeClass(variable);
if (Objects.isNull(variable)
|| !String.class.equals(dataType)
|| StringUtils.isBlank((String) variable)) {
if (Objects.isNull(variable) || !String.class.equals(dataType)) {
throwException(
pathCheck,
String.format(
Expand All @@ -72,6 +70,15 @@ default boolean checkExpectString(PathCheck pathCheck, Object variable) {
variable,
(dataType == null ? null : dataType.getSimpleName()),
"String"));
} else if (StringUtils.isBlank((String) variable)) {
throwException(
pathCheck,
String.format(
EXPECT_INT_MSG,
extractCheckingPath(pathCheck.path()),
variable,
"empty string",
"Non Empty String"));
}
return true;
}
Expand Down

0 comments on commit b3427f4

Please sign in to comment.