Total Complexity | 3 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | package com.hltech.vaunt.validator; |
||
10 | @Data |
||
11 | class ValidationResult { |
||
12 | private final boolean isValid; |
||
13 | private final String description; |
||
14 | private final List<ValidationError> errors; |
||
15 | |||
16 | static ValidationResult success(Contract expectation, Contract capability) { |
||
17 | return new ValidationResult( |
||
18 | true, |
||
19 | String.format("Expectation: %s, capability: %s", expectation, capability), |
||
20 | new ArrayList<>()); |
||
21 | } |
||
22 | |||
23 | static ValidationResult failure(Contract expectation, ValidationError... errors) { |
||
24 | return new ValidationResult(false, String.format("Expectation: %s", expectation), Arrays.asList(errors)); |
||
25 | } |
||
26 | |||
27 | static ValidationResult failure( |
||
28 | Contract expectation, List<Contract> capabilities, ValidationError... errors) { |
||
29 | return new ValidationResult( |
||
30 | false, |
||
31 | String.format("Expectation: %s, capabilities: %s", expectation, capabilities), |
||
32 | Arrays.asList(errors)); |
||
33 | } |
||
35 |