@Test public void test_should_not_throw_exception_when_Text_Area__format_is_valid() { final TextareaAttributeValidator validator = new TextareaAttributeValidator(); final ServiceRequest serviceRequest = mock(ServiceRequest.class); when(serviceRequest.getAttributeWithKey("TextArea1")) .thenReturn(new AttributeEntry("TextArea1", "hai hello")); final AttributeDefinition attributeDefinition = AttributeDefinition.builder() .dataType(AttributeDataType.TEXTAREA) .code("TextArea1") .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> nonComputedTextAreaAttributes = serviceDefinition.getNonComputedTextAreaAttributes(); if (CollectionUtils.isEmpty(nonComputedTextAreaAttributes)) { return; } nonComputedTextAreaAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingTextAreaAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingTextAreaAttributeEntry == null || isEmpty(matchingTextAreaAttributeEntry.getCode())) { return; } validateTextArea(matchingTextAreaAttributeEntry); }); }
TextareaAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedTextAreaAttributes = serviceDefinition.getNonComputedTextAreaAttributes(); if (CollectionUtils.isEmpty(nonComputedTextAreaAttributes)) { return; } nonComputedTextAreaAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingTextAreaAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingTextAreaAttributeEntry == null || isEmpty(matchingTextAreaAttributeEntry.getCode())) { return; } validateTextArea(matchingTextAreaAttributeEntry); }); } }
TextareaAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedTextAreaAttributes = serviceDefinition.getNonComputedTextAreaAttributes(); if (CollectionUtils.isEmpty(nonComputedTextAreaAttributes)) { return; } nonComputedTextAreaAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingTextAreaAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingTextAreaAttributeEntry == null || isEmpty(matchingTextAreaAttributeEntry.getCode())) { return; } validateTextArea(matchingTextAreaAttributeEntry); }); }  }
TextareaAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedTextAreaAttributes = serviceDefinition.getNonComputedTextAreaAttributes(); if (CollectionUtils.isEmpty(nonComputedTextAreaAttributes)) { return; } nonComputedTextAreaAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingTextAreaAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingTextAreaAttributeEntry == null || isEmpty(matchingTextAreaAttributeEntry.getCode())) { return; } validateTextArea(matchingTextAreaAttributeEntry); }); }  @Override void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action); }
TextareaAttributeValidator implements AttributeValueValidator { @Override public void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action) { final List<AttributeDefinition> nonComputedTextAreaAttributes = serviceDefinition.getNonComputedTextAreaAttributes(); if (CollectionUtils.isEmpty(nonComputedTextAreaAttributes)) { return; } nonComputedTextAreaAttributes.forEach(attributeDefinition -> { final AttributeEntry matchingTextAreaAttributeEntry = serviceRequest .getAttributeWithKey(attributeDefinition.getCode()); if(matchingTextAreaAttributeEntry == null || isEmpty(matchingTextAreaAttributeEntry.getCode())) { return; } validateTextArea(matchingTextAreaAttributeEntry); }); }  @Override void validate(ServiceRequest serviceRequest, ServiceDefinition serviceDefinition, ServiceStatus action);  }