### Question:
OntologyDataServiceImpl implements OntologyDataService { void checkJsonCompliantWithSchema(final JsonNode data, final JsonNode schemaJson) throws ProcessingException { final JsonSchemaFactory factoryJson = JsonSchemaFactory.byDefault(); final JsonSchema schema = factoryJson.getJsonSchema(schemaJson); try { final ProcessingReport report = schema.validate(data); if (report != null && !report.isSuccess()) { final Iterator<ProcessingMessage> it = report.iterator(); final StringBuilder msgerror = new StringBuilder(); while (it.hasNext()) { final ProcessingMessage msg = it.next(); if (msg.getLogLevel().equals(LogLevel.ERROR)) { msgerror.append(msg.asJson()); } } throw new DataSchemaValidationException( "Error processing data:" + data.toString() + "by:" + msgerror.toString()); } } catch (final DataSchemaValidationException e) { throw e; } catch (final Exception e) { log.error("", e); throw new DataSchemaValidationException( "Error processing data:" + data.toString() + "by:" + e.getMessage()); } }  @Override void checkOntologySchemaCompliance(final JsonNode data, final Ontology ontology); @Override List<String> preProcessInsertData(OperationModel operationModel, final boolean addContext); @Override String preProcessUpdateData(final OperationModel operationModel); @Override String decrypt(String data, String ontologyName, String user); @Override void checkTitleCaseSchema(String jsonSchema); void processPropertiesForTitleCase(String field, JsonNode value, JsonNode root, String pointer); @Override void checkRequiredFields(String dbJsonSchema, String newJsonSchema); void proccessRequiredProperties(JsonNode oldSchema, JsonNode newSchema); void iteratePropertiesRequired(JsonNode oldSchema, JsonNode newSchema); void processSingleProperty4Required(JsonNode oldSchema, JsonNode newSchema); @Override String refJsonSchema(JsonNode schema); @Override ProcessingReport reportJsonSchemaValid(String jsonSchema); @Override Set<OntologyRelation> getOntologyReferences(String ontologyIdentification); @Override Map<String, String> getOntologyPropertiesWithPath4Type(String ontologyIdentification, String type); @Override void checkSameSchema(String dbJsonSchema, String newJsonSchema); @Override String decryptAllUsers(String data, String ontologyName); @Override String encryptQuery(String query, boolean mongo);  }### Answer:
@Test public void given_OneValidJsonSchemaAndOneCompliantJson_When_TheJsonIsValidated_Then_ExceptionIsNotLauched() throws DataSchemaValidationException { service.checkJsonCompliantWithSchema(TestResources.DATA_FOR_GOOD_JSON, TestResources.GOOD_JSON_SCHEMA); }
@Test(expected = DataSchemaValidationException.class) public void given_OneInvalidJsonSchemaAndOneCompliantJson_When_TheJsonIsValidated_Then_ExceptionIsLauched() throws DataSchemaValidationException { service.checkJsonCompliantWithSchema(TestResources.DATA_FOR_GOOD_JSON, TestResources.BAD_JSON_SCHEMA); }
@Test(expected = DataSchemaValidationException.class) public void given_OneValidJsonSchemaAndOneNotCompliantJson_When_TheJsonIsValidated_Then_ItReturnsFalse() throws DataSchemaValidationException { service.checkJsonCompliantWithSchema(TestResources.DATA_FOR_NONVALID_JSON, TestResources.GOOD_JSON_SCHEMA); }
@Test(expected = DataSchemaValidationException.class) public void given_OneValidJsonSchemaAndOneIncorrectJson_When_TheJsonIsValidated_Then_ItReturnsFalse() throws DataSchemaValidationException { service.checkJsonCompliantWithSchema(TestResources.DATA_FOR_BAD_JSON, TestResources.GOOD_JSON_SCHEMA); }