Conditions | 4 |
Total Lines | 28 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | package com.hltech.vaunt.validator; |
||
12 | public static List<String> validate(StringSchema consumerSchema, StringSchema providerSchema) { |
||
13 | List<String> errors = new ArrayList<>(ValueTypeSchemaValidator.validate(consumerSchema, providerSchema)); |
||
14 | |||
15 | if (!equals(consumerSchema.getMinLength(), providerSchema.getMinLength())) { |
||
16 | errors.add(String.format(ERROR_FORMAT, |
||
17 | consumerSchema.getId(), |
||
18 | "minLength", |
||
19 | consumerSchema.getMinLength(), |
||
20 | providerSchema.getMinLength())); |
||
21 | } |
||
22 | |||
23 | if (!equals(consumerSchema.getMaxLength(), providerSchema.getMaxLength())) { |
||
24 | errors.add(String.format(ERROR_FORMAT, |
||
25 | consumerSchema.getId(), |
||
26 | "maxLength", |
||
27 | consumerSchema.getMaxLength(), |
||
28 | providerSchema.getMaxLength())); |
||
29 | } |
||
30 | |||
31 | if (!equals(consumerSchema.getPattern(), providerSchema.getPattern())) { |
||
32 | errors.add(String.format(ERROR_FORMAT, |
||
33 | consumerSchema.getId(), |
||
34 | "pattern", |
||
35 | consumerSchema.getPattern(), |
||
36 | providerSchema.getPattern())); |
||
37 | } |
||
38 | |||
39 | return errors; |
||
40 | } |
||
50 |