Skip to content

Commit

Permalink
fixed 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
liangbaika committed Jan 29, 2021
1 parent 29c04d5 commit 339df65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,7 @@ public int getFailedCounts() {
* @return int
*/
public int getSuccedCounts() {
if (chains == null || chains.isEmpty()) {
return 0;
}
return chains.size() - chains.stream()
.filter(e -> Boolean.FALSE.equals(e.getResult()))
.collect(Collectors.toList())
.size();
return chains.size() - getFailedCounts();
}

public List<ValidateChain> getChains() {
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/com/github/liangbaika/validate/test/Tests.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ public static void main(String[] args) {

ValidateBuilder validateBuilder = ValidateBuilder.build();
int failedCounts = validateBuilder
.vali(ne, "测试不等", "测试不等")
.vali(ne, "3", "3","不能等于")
.vali(Chinese, "测试中文")
.vali(isBirthdaystr, "1992-12-09")
.vali(isUrl, "https://baidu.com")
.doCheck()
.getFailedCounts();
System.out.println(failedCounts);
System.out.println(validateBuilder.isPassed());
System.out.println(validateBuilder.getSuccedCounts());
System.out.println(validateBuilder.getFailedMsgs());
System.out.println(validateBuilder.isPassed());


//重复使用 validateBuilder 先调用clear方法
int failedCounts2 = validateBuilder
Expand Down

0 comments on commit 339df65

Please sign in to comment.