@Test public void givenConstructorWithIncorrectSchemaThenException() { assertThatThrownBy(() -> JsonSchemaValidator.forBuiltInSchema("/test.conf")) .isInstanceOf(VitamRuntimeException.class); }
public static JsonSchemaValidator forBuiltInSchema(String schemaFilename) { try (InputStream is = JsonSchemaValidator.class.getResourceAsStream(schemaFilename)) { JsonNode schemaJson = JsonHandler.getFromInputStream(is); JsonSchema jsonSchema = JSON_SCHEMA_FACTORY.getJsonSchema(schemaJson); return new JsonSchemaValidator(jsonSchema); } catch (InvalidParseOperationException | ProcessingException | IOException e) { throw new VitamRuntimeException("Could not initialize built-in schema file " + schemaFilename); } }
JsonSchemaValidator { public static JsonSchemaValidator forBuiltInSchema(String schemaFilename) { try (InputStream is = JsonSchemaValidator.class.getResourceAsStream(schemaFilename)) { JsonNode schemaJson = JsonHandler.getFromInputStream(is); JsonSchema jsonSchema = JSON_SCHEMA_FACTORY.getJsonSchema(schemaJson); return new JsonSchemaValidator(jsonSchema); } catch (InvalidParseOperationException | ProcessingException | IOException e) { throw new VitamRuntimeException("Could not initialize built-in schema file " + schemaFilename); } } }
JsonSchemaValidator { public static JsonSchemaValidator forBuiltInSchema(String schemaFilename) { try (InputStream is = JsonSchemaValidator.class.getResourceAsStream(schemaFilename)) { JsonNode schemaJson = JsonHandler.getFromInputStream(is); JsonSchema jsonSchema = JSON_SCHEMA_FACTORY.getJsonSchema(schemaJson); return new JsonSchemaValidator(jsonSchema); } catch (InvalidParseOperationException | ProcessingException | IOException e) { throw new VitamRuntimeException("Could not initialize built-in schema file " + schemaFilename); } } private  JsonSchemaValidator(JsonSchema jsonSchema); }
JsonSchemaValidator { public static JsonSchemaValidator forBuiltInSchema(String schemaFilename) { try (InputStream is = JsonSchemaValidator.class.getResourceAsStream(schemaFilename)) { JsonNode schemaJson = JsonHandler.getFromInputStream(is); JsonSchema jsonSchema = JSON_SCHEMA_FACTORY.getJsonSchema(schemaJson); return new JsonSchemaValidator(jsonSchema); } catch (InvalidParseOperationException | ProcessingException | IOException e) { throw new VitamRuntimeException("Could not initialize built-in schema file " + schemaFilename); } } private  JsonSchemaValidator(JsonSchema jsonSchema); static JsonSchemaValidator forBuiltInSchema(String schemaFilename); static JsonSchemaValidator forUserSchema(String schemaJsonAsString); void validateJson(JsonNode jsonNode); }
JsonSchemaValidator { public static JsonSchemaValidator forBuiltInSchema(String schemaFilename) { try (InputStream is = JsonSchemaValidator.class.getResourceAsStream(schemaFilename)) { JsonNode schemaJson = JsonHandler.getFromInputStream(is); JsonSchema jsonSchema = JSON_SCHEMA_FACTORY.getJsonSchema(schemaJson); return new JsonSchemaValidator(jsonSchema); } catch (InvalidParseOperationException | ProcessingException | IOException e) { throw new VitamRuntimeException("Could not initialize built-in schema file " + schemaFilename); } } private  JsonSchemaValidator(JsonSchema jsonSchema); static JsonSchemaValidator forBuiltInSchema(String schemaFilename); static JsonSchemaValidator forUserSchema(String schemaJsonAsString); void validateJson(JsonNode jsonNode);  }