### Question:
LoadManifestValidationServiceImpl implements ILoadManifestValidationService { @Override public Set<ValidationMessage> validateManifest(WorkProductLoadManifest loadManifest) { log.debug("Start validating load manifest : {}", loadManifest); SchemaData schemaData = schemaRepository.findByTitle(WP_LOAD_MANIFEST_SCHEMA_TITLE); JsonNode manifest = objectMapper.valueToTree(loadManifest); Set<ValidationMessage> errors = jsonValidationService .validate(schemaData.getSchema(), manifest); log.debug("Validation result: {}", errors); return errors; }  @Override Set<ValidationMessage> validateManifest(WorkProductLoadManifest loadManifest);  }### Answer:
@Test void shouldReturnsEmptyErrorSet() throws Exception { WorkProductLoadManifest loadManifest = WorkProductLoadManifest.builder() .build(); JsonNode schemaJsonNode = objectMapper.readTree(getResource(DRAFT_07_SCHEMA_PATH)); JsonNode manifestJsonNode = objectMapper.readTree(objectMapper.writeValueAsString(loadManifest)); given(schemaRepository.findByTitle(SCHEMA_TITLE)).willReturn( SchemaData.builder() .schema(schemaJsonNode) .build()); given(jsonValidationService.validate(schemaJsonNode, manifestJsonNode)) .willReturn(Collections.emptySet()); Set<ValidationMessage> errors = loadManifestValidationService .validateManifest(loadManifest); then(errors).isEmpty(); }
@Test void shouldReturnsNonEmptyErrorSet() throws Exception { WorkProductLoadManifest loadManifest = WorkProductLoadManifest.builder() .build(); JsonNode schemaJsonNode = objectMapper.readTree(getResource(DRAFT_07_SCHEMA_PATH)); JsonNode manifestJsonNode = objectMapper.readTree(objectMapper.writeValueAsString(loadManifest)); ValidationMessage message = ValidationMessage.of("type", ValidatorTypeCode.TYPE, "$.WorkProduct", "null", "object"); given(schemaRepository.findByTitle(SCHEMA_TITLE)).willReturn( SchemaData.builder() .schema(schemaJsonNode) .build()); given(jsonValidationService.validate(schemaJsonNode, manifestJsonNode)) .willReturn(Collections.singleton(message)); Set<ValidationMessage> errors = loadManifestValidationService .validateManifest(loadManifest); then(errors).hasSize(1); }