@Test public void test_should_not_throw_exception_when_integer_format_is_valid() { final IntegerAttributeValidator validator = new IntegerAttributeValidator(); final ServiceRequest serviceRequest = mock(ServiceRequest.class); when(serviceRequest.getAttributeWithKey("integer1")) .thenReturn(new AttributeEntry("integer1", "15")); final AttributeDefinition attributeDefinition = AttributeDefinition.builder() .dataType(AttributeDataType.INTEGER) .code("integer1") .build(); final ServiceDefinition serviceDefinition = ServiceDefinition.builder() .attributes(Collections.singletonList(attributeDefinition)) .build(); validator.validate(serviceRequest, serviceDefinition, ServiceStatus.CITIZEN_SERVICE_APPROVED); }
@Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedIntegerAttributes = serviceDefinition.getNonComputedIntegerAttributes(); if (CollectionUtils.isEmpty(nonComputedIntegerAttributes)) { return; } nonComputedIntegerAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingIntegerAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingIntegerAttributeEntry == null || isEmpty(matchingIntegerAttributeEntry.getCode())) { return; } validateInteger(matchingIntegerAttributeEntry); }); }
IntegerAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedIntegerAttributes = serviceDefinition.getNonComputedIntegerAttributes(); if (CollectionUtils.isEmpty(nonComputedIntegerAttributes)) { return; } nonComputedIntegerAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingIntegerAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingIntegerAttributeEntry == null || isEmpty(matchingIntegerAttributeEntry.getCode())) { return; } validateInteger(matchingIntegerAttributeEntry); }); } }
IntegerAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedIntegerAttributes = serviceDefinition.getNonComputedIntegerAttributes(); if (CollectionUtils.isEmpty(nonComputedIntegerAttributes)) { return; } nonComputedIntegerAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingIntegerAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingIntegerAttributeEntry == null || isEmpty(matchingIntegerAttributeEntry.getCode())) { return; } validateInteger(matchingIntegerAttributeEntry); }); }  }
IntegerAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedIntegerAttributes = serviceDefinition.getNonComputedIntegerAttributes(); if (CollectionUtils.isEmpty(nonComputedIntegerAttributes)) { return; } nonComputedIntegerAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingIntegerAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingIntegerAttributeEntry == null || isEmpty(matchingIntegerAttributeEntry.getCode())) { return; } validateInteger(matchingIntegerAttributeEntry); }); }  @Override void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action); }
IntegerAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedIntegerAttributes = serviceDefinition.getNonComputedIntegerAttributes(); if (CollectionUtils.isEmpty(nonComputedIntegerAttributes)) { return; } nonComputedIntegerAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingIntegerAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingIntegerAttributeEntry == null || isEmpty(matchingIntegerAttributeEntry.getCode())) { return; } validateInteger(matchingIntegerAttributeEntry); }); }  @Override void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action);  }