diff options
author | Pawel <pawel.kasperkiewicz@nokia.com> | 2019-12-20 09:56:29 +0100 |
---|---|---|
committer | Pawel <pawel.kasperkiewicz@nokia.com> | 2020-01-15 09:36:22 +0100 |
commit | 7e5a7d1d8cd74e42c8549e02724ec2df589e4117 (patch) | |
tree | ddb478a9bc8c7d7abbfa8d74a5acc902b6c4045a /src/test/java/org/onap/dcae/restapi | |
parent | e880d42248d5b6958676b748fdee53eed950ac17 (diff) |
updated jackson-databind and changed json schema validator library
Issue-ID: DCAEGEN2-1825
Signed-off-by: Pawel <pawel.kasperkiewicz@nokia.com>
Change-Id: Ia4c9c6286adcf84631a58f9d5bfef124fed1cee6
Diffstat (limited to 'src/test/java/org/onap/dcae/restapi')
-rw-r--r-- | src/test/java/org/onap/dcae/restapi/EventValidatorTest.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/test/java/org/onap/dcae/restapi/EventValidatorTest.java b/src/test/java/org/onap/dcae/restapi/EventValidatorTest.java index 5bacd31c..4ac3c487 100644 --- a/src/test/java/org/onap/dcae/restapi/EventValidatorTest.java +++ b/src/test/java/org/onap/dcae/restapi/EventValidatorTest.java @@ -20,9 +20,8 @@ package org.onap.dcae.restapi; -import com.github.fge.jackson.JsonLoader; -import com.github.fge.jsonschema.core.exceptions.ProcessingException; -import com.github.fge.jsonschema.main.JsonSchemaFactory; +import com.networknt.schema.JsonSchema; +import com.networknt.schema.JsonSchemaFactory; import org.json.JSONObject; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -84,7 +83,7 @@ public class EventValidatorTest { } @Test - public void shouldReturnSchemaValidationFailedErrorOnInvalidJsonObjectSchema() throws ProcessingException, IOException { + public void shouldReturnSchemaValidationFailedErrorOnInvalidJsonObjectSchema() throws IOException { //given String schemaRejectingEverything = "{\"not\":{}}"; mockJsonSchema(schemaRejectingEverything); @@ -98,7 +97,7 @@ public class EventValidatorTest { } @Test - public void shouldReturnEmptyOptionalOnValidJsonObjectSchema() throws ProcessingException, IOException { + public void shouldReturnEmptyOptionalOnValidJsonObjectSchema() throws IOException { //given String schemaAcceptingEverything = "{}"; mockJsonSchema(schemaAcceptingEverything); @@ -111,10 +110,11 @@ public class EventValidatorTest { assertEquals(Optional.empty(), result); } - private void mockJsonSchema(String jsonSchema) throws IOException, ProcessingException { - when(settings.jsonSchema(any())).thenReturn( - JsonSchemaFactory.byDefault() - .getJsonSchema(JsonLoader.fromString(jsonSchema))); + private void mockJsonSchema(String jsonSchemaContent) { + JsonSchemaFactory factory = JsonSchemaFactory.getInstance(); + + JsonSchema schema = factory.getSchema(jsonSchemaContent); + when(settings.jsonSchema(any())).thenReturn(schema); } private Optional<ResponseEntity<String>> generateResponseOptional(ApiException schemaValidationFailed) { |