@Test public void test_should_not_throw_exception_when_double_format_is_valid() { final DoubleAttributeValidator validator = new DoubleAttributeValidator(); final ServiceRequest serviceRequest = mock(ServiceRequest.class); when(serviceRequest.getAttributeWithKey("double1")) .thenReturn(new AttributeEntry("double1", "15.345")); final AttributeDefinition attributeDefinition = AttributeDefinition.builder() .dataType(AttributeDataType.DOUBLE) .code("double1") .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> nonComputedDoubleAttributes = serviceDefinition.getNonComputedDoubleAttributes(); if (CollectionUtils.isEmpty(nonComputedDoubleAttributes)) { return; } nonComputedDoubleAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingDoubleAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingDoubleAttributeEntry == null || isEmpty(matchingDoubleAttributeEntry.getCode())) { return; } validateDoubleFormat(matchingDoubleAttributeEntry); }); }
DoubleAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedDoubleAttributes = serviceDefinition.getNonComputedDoubleAttributes(); if (CollectionUtils.isEmpty(nonComputedDoubleAttributes)) { return; } nonComputedDoubleAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingDoubleAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingDoubleAttributeEntry == null || isEmpty(matchingDoubleAttributeEntry.getCode())) { return; } validateDoubleFormat(matchingDoubleAttributeEntry); }); } }
DoubleAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedDoubleAttributes = serviceDefinition.getNonComputedDoubleAttributes(); if (CollectionUtils.isEmpty(nonComputedDoubleAttributes)) { return; } nonComputedDoubleAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingDoubleAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingDoubleAttributeEntry == null || isEmpty(matchingDoubleAttributeEntry.getCode())) { return; } validateDoubleFormat(matchingDoubleAttributeEntry); }); }  }
DoubleAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedDoubleAttributes = serviceDefinition.getNonComputedDoubleAttributes(); if (CollectionUtils.isEmpty(nonComputedDoubleAttributes)) { return; } nonComputedDoubleAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingDoubleAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingDoubleAttributeEntry == null || isEmpty(matchingDoubleAttributeEntry.getCode())) { return; } validateDoubleFormat(matchingDoubleAttributeEntry); }); }  @Override void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action); }
DoubleAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedDoubleAttributes = serviceDefinition.getNonComputedDoubleAttributes(); if (CollectionUtils.isEmpty(nonComputedDoubleAttributes)) { return; } nonComputedDoubleAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingDoubleAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingDoubleAttributeEntry == null || isEmpty(matchingDoubleAttributeEntry.getCode())) { return; } validateDoubleFormat(matchingDoubleAttributeEntry); }); }  @Override void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action);  }