| Total Complexity | 3 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package com.hltech.vaunt.validator.schema; |
||
| 8 | public class IntegerSchemaValidator extends NumberSchemaValidator { |
||
| 9 | |||
| 10 | @Override |
||
| 11 | public List<String> validate(JsonSchema consumerSchema, JsonSchema providerSchema) { |
||
| 12 | List<String> errors = super.validate(consumerSchema, providerSchema); |
||
| 13 | |||
| 14 | IntegerSchema consumerIntegerSchema = consumerSchema.asIntegerSchema(); |
||
| 15 | IntegerSchema providerIntegerSchema = providerSchema.asIntegerSchema(); |
||
| 16 | |||
| 17 | if (!isValid(consumerIntegerSchema.getDivisibleBy(), providerIntegerSchema.getDivisibleBy())) { |
||
| 18 | errors.add(String.format(ERROR_FORMAT, |
||
| 19 | consumerIntegerSchema.getId(), |
||
| 20 | "divisibleBy", |
||
| 21 | consumerIntegerSchema.getDivisibleBy(), |
||
| 22 | providerIntegerSchema.getDivisibleBy())); |
||
| 23 | } |
||
| 24 | |||
| 25 | return errors; |
||
| 26 | } |
||
| 27 | |||
| 28 | @Override |
||
| 29 | public Class<?> supportsSchemaType() { |
||
| 30 | return IntegerSchema.class; |
||
| 31 | } |
||
| 33 |