File tree Expand file tree Collapse file tree
json/src/test/java/org/baeldung/json/schema Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .baeldung .json .schema ;
22
33import org .everit .json .schema .Schema ;
4- import org .everit .json .schema .ValidationException ;
54import org .everit .json .schema .loader .SchemaLoader ;
65
76import org .json .JSONObject ;
@@ -17,17 +16,7 @@ public void givenInvalidInput_whenValidating_thenInvalid() {
1716 JSONObject jsonSubject = new JSONObject (new JSONTokener (JSONSchemaTest .class .getResourceAsStream ("/product_invalid.json" )));
1817
1918 Schema schema = SchemaLoader .load (jsonSchema );
20-
21- try {
22-
23- schema .validate (jsonSubject );
24- }
25-
26- catch (ValidationException e ) {
27-
28- System .out .println (e .getMessage ());
29- e .getCausingExceptions ().stream ().map (ValidationException ::getMessage ).forEach (System .out ::println );
30- }
19+ schema .validate (jsonSubject );
3120 }
3221
3322 @ Test
@@ -37,16 +26,6 @@ public void givenValidInput_whenValidating_thenValid() {
3726 JSONObject jsonSubject = new JSONObject (new JSONTokener (JSONSchemaTest .class .getResourceAsStream ("/product_valid.json" )));
3827
3928 Schema schema = SchemaLoader .load (jsonSchema );
40-
41- try {
42-
43- schema .validate (jsonSubject );
44- }
45-
46- catch (ValidationException e ) {
47-
48- System .out .println (e .getMessage ());
49- e .getCausingExceptions ().stream ().map (ValidationException ::getMessage ).forEach (System .out ::println );
50- }
29+ schema .validate (jsonSubject );
5130 }
5231}
You can’t perform that action at this time.
0 commit comments