### Question:
JsonSchemaContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { JsonNode node = objectMapper.readTree(artifactContent.bytes()); if (level == ValidityLevel.FULL) { JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7); factory.getSchema(node); } } catch (Exception e) { throw new InvalidContentException("Syntax violation for JSON Schema artifact.", e); } } } JsonSchemaContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent);  }### Answer:
@Test public void testValidJsonSchema() throws Exception { ContentHandle content = resourceToContentHandle("jsonschema-valid.json"); JsonSchemaContentValidator validator = new JsonSchemaContentValidator(); validator.validate(ValidityLevel.SYNTAX_ONLY, content); }
@Test public void testInvalidJsonSchema() throws Exception { ContentHandle content = resourceToContentHandle("jsonschema-invalid.json"); JsonSchemaContentValidator validator = new JsonSchemaContentValidator(); Assertions.assertThrows(InvalidContentException.class, () -> { validator.validate(ValidityLevel.SYNTAX_ONLY, content); }); }
@Test public void testInvalidJsonSchemaVersion() throws Exception { ContentHandle content = resourceToContentHandle("jsonschema-valid-d7.json"); JsonSchemaContentValidator validator = new JsonSchemaContentValidator(); validator.validate(ValidityLevel.FULL, content); }