version:>= 1.6.3
该属性,表示匹配值为空或者null的字符类型
示例:
@Data
@Accessors(chain = true)
public class IsBlankEntity {
@Matcher(isBlank = "true")
private String name;
private Integer age;
}
测试
def "为null测试"() {
given:
IsBlankEntity entity = new IsBlankEntity().setName(name)
expect:
boolean actResult = MkValidators.check(entity, "name")
if (!actResult) {
println MkValidators.getErrMsg()
println MkValidators.getErrMsgChain()
}
Assert.assertEquals(result, actResult)
where:
name | result
"a" | false
null | true
null | true
"" | true
"a" | false
}