@@ -40,7 +40,7 @@ public void setup() throws Exception {
40
40
41
41
@ Test
42
42
public void checkThatBundledSchemaLoadsAndValidatesCorrectly () throws Exception {
43
- JsonSchema rootSchema = factory .getSchema (new URI ("resource:data /issue619.json" ));
43
+ JsonSchema rootSchema = factory .getSchema (new URI ("resource:schema /issue619.json" ));
44
44
45
45
assertTrue (rootSchema .validate (one ).isEmpty ());
46
46
assertTrue (rootSchema .validate (two ).isEmpty ());
@@ -49,7 +49,7 @@ public void checkThatBundledSchemaLoadsAndValidatesCorrectly() throws Exception
49
49
50
50
@ Test
51
51
public void checkThatSchemaThatReferencesBundledSchemaLoadsAndValidatesCorrectly () {
52
- JsonSchema referencingRootSchema = factory .getSchema ("{ \" $ref\" : \" resource:data /issue619.json\" }" );
52
+ JsonSchema referencingRootSchema = factory .getSchema ("{ \" $ref\" : \" resource:schema /issue619.json\" }" );
53
53
54
54
assertTrue (referencingRootSchema .validate (one ).isEmpty ());
55
55
assertTrue (referencingRootSchema .validate (two ).isEmpty ());
@@ -58,7 +58,7 @@ public void checkThatSchemaThatReferencesBundledSchemaLoadsAndValidatesCorrectly
58
58
59
59
@ Test
60
60
public void checkThatUriThatPointsToEmptyFragmentLoadsAndValidatesCorrectly () throws Exception {
61
- JsonSchema rootSchema = factory .getSchema (new URI ("resource:data /issue619.json#" ));
61
+ JsonSchema rootSchema = factory .getSchema (new URI ("resource:schema /issue619.json#" ));
62
62
63
63
assertTrue (rootSchema .validate (one ).isEmpty ());
64
64
assertTrue (rootSchema .validate (two ).isEmpty ());
@@ -67,7 +67,7 @@ public void checkThatUriThatPointsToEmptyFragmentLoadsAndValidatesCorrectly() th
67
67
68
68
@ Test
69
69
public void checkThatSchemaThatReferencesEmptyFragmentLoadsAndValidatesCorrectly () {
70
- JsonSchema referencingRootSchema = factory .getSchema ("{ \" $ref\" : \" resource:data /issue619.json#\" }" );
70
+ JsonSchema referencingRootSchema = factory .getSchema ("{ \" $ref\" : \" resource:schema /issue619.json#\" }" );
71
71
72
72
assertTrue (referencingRootSchema .validate (one ).isEmpty ());
73
73
assertTrue (referencingRootSchema .validate (two ).isEmpty ());
@@ -76,7 +76,7 @@ public void checkThatSchemaThatReferencesEmptyFragmentLoadsAndValidatesCorrectly
76
76
77
77
@ Test
78
78
public void loadingSchemaWithUriThatPointsToOneShouldOnlyValidateOne () throws Exception {
79
- JsonSchema oneSchema = factory .getSchema (new URI ("resource:data /issue619.json#/definitions/one" ));
79
+ JsonSchema oneSchema = factory .getSchema (new URI ("resource:schema /issue619.json#/definitions/one" ));
80
80
81
81
assertTrue (oneSchema .validate (one ).isEmpty ());
82
82
assertFalse (oneSchema .validate (two ).isEmpty ());
@@ -85,13 +85,31 @@ public void loadingSchemaWithUriThatPointsToOneShouldOnlyValidateOne() throws Ex
85
85
86
86
@ Test
87
87
public void referencingSchemaWithUriThatPointsToTwoShouldOnlyValidateTwo () {
88
- JsonSchema referencingTwoSchema = factory .getSchema ("{ \" $ref\" : \" resource:data /issue619.json#/definitions/two\" }" );
88
+ JsonSchema referencingTwoSchema = factory .getSchema ("{ \" $ref\" : \" resource:schema /issue619.json#/definitions/two\" }" );
89
89
90
90
assertFalse (referencingTwoSchema .validate (one ).isEmpty ());
91
91
assertTrue (referencingTwoSchema .validate (two ).isEmpty ());
92
92
assertFalse (referencingTwoSchema .validate (three ).isEmpty ());
93
93
}
94
94
95
+ @ Test
96
+ public void loadingSchemaWithUriThatPointsToNodeThatInTurnReferencesOneShouldOnlyValidateOne () throws Exception {
97
+ JsonSchema oneSchema = factory .getSchema (new URI ("resource:schema/issue619.json#/definitions/refToOne" ));
98
+
99
+ assertTrue (oneSchema .validate (one ).isEmpty ());
100
+ assertFalse (oneSchema .validate (two ).isEmpty ());
101
+ assertFalse (oneSchema .validate (three ).isEmpty ());
102
+ }
103
+
104
+ @ Test
105
+ public void referencingSchemaWithUriThatPointsToNodeThatInTurnReferencesOneShouldOnlyValidateOne () {
106
+ JsonSchema referencingTwoSchema = factory .getSchema ("{ \" $ref\" : \" resource:schema/issue619.json#/definitions/refToOne\" }" );
107
+
108
+ assertTrue (referencingTwoSchema .validate (one ).isEmpty ());
109
+ assertFalse (referencingTwoSchema .validate (two ).isEmpty ());
110
+ assertFalse (referencingTwoSchema .validate (three ).isEmpty ());
111
+ }
112
+
95
113
@ Test
96
114
public void loadingSchemaWithUriThatPointsToSchemaThatDoesNotExistShouldFail () {
97
115
assertThrows (JsonSchemaException .class , () -> factory .getSchema (new URI ("resource:data/schema-that-does-not-exist.json#/definitions/something" )));
@@ -106,12 +124,12 @@ public void referencingSchemaWithUriThatPointsToSchemaThatDoesNotExistShouldFail
106
124
107
125
@ Test
108
126
public void loadingSchemaWithUriThatPointsToNodeThatDoesNotExistShouldFail () {
109
- assertThrows (JsonSchemaException .class , () -> factory .getSchema (new URI ("resource:data /issue619.json#/definitions/node-that-does-not-exist" )));
127
+ assertThrows (JsonSchemaException .class , () -> factory .getSchema (new URI ("resource:schema /issue619.json#/definitions/node-that-does-not-exist" )));
110
128
}
111
129
112
130
@ Test
113
131
public void referencingSchemaWithUriThatPointsToNodeThatDoesNotExistShouldFail () {
114
- JsonSchema referencingNonexistentSchema = factory .getSchema ("{ \" $ref\" : \" resource:data /issue619.json#/definitions/node-that-does-not-exist\" }" );
132
+ JsonSchema referencingNonexistentSchema = factory .getSchema ("{ \" $ref\" : \" resource:schema /issue619.json#/definitions/node-that-does-not-exist\" }" );
115
133
116
134
assertThrows (JsonSchemaException .class , () -> referencingNonexistentSchema .validate (one ));
117
135
}
0 commit comments