Skip to content

Commit d0ccf94

Browse files
committed
adding skipped repreoduction test for #38
1 parent e1234cc commit d0ccf94

File tree

3 files changed

+85
-5
lines changed

3 files changed

+85
-5
lines changed

tests/src/test/java/org/everit/json/schema/IssueTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.json.JSONObject;
3535
import org.json.JSONTokener;
3636
import org.junit.Assert;
37+
import org.junit.Assume;
3738
import org.junit.Test;
3839
import org.junit.runner.RunWith;
3940
import org.junit.runners.Parameterized;
@@ -103,6 +104,7 @@ private void stopJetty() {
103104

104105
@Test
105106
public void test() {
107+
Assume.assumeFalse("issue dir starts with 'x' - ignoring", issueDir.getName().startsWith("x"));
106108
fileByName("remotes").ifPresent(this::initJetty);
107109
Schema schema = loadSchema();
108110
fileByName("subject-valid.json").ifPresent(file -> validate(file, schema, true));
@@ -157,8 +159,7 @@ private Object loadJsonFile(final File file) {
157159
if (jsonTest instanceof JSONObject) {
158160
// The message contains a single JSON object
159161
subject = jsonTest;
160-
}
161-
else if (jsonTest instanceof JSONArray) {
162+
} else if (jsonTest instanceof JSONArray) {
162163
// The message contains a JSON array
163164
subject = jsonTest;
164165
}
@@ -174,9 +175,9 @@ else if (jsonTest instanceof JSONArray) {
174175
* Allow users to provide expected values for validation failures. This method reads and parses
175176
* files formatted like the following:
176177
*
177-
* { "message": "#: 2 schema violations found", "causingExceptions": [ { "message":
178-
* "#/0/name: expected type: String, found: JSONArray", "causingExceptions": [] }, { "message":
179-
* "#/1: required key [price] not found", "causingExceptions": [] } ] }
178+
* { "message": "#: 2 schema violations found", "causingExceptions": [ { "message": "#/0/name:
179+
* expected type: String, found: JSONArray", "causingExceptions": [] }, { "message": "#/1:
180+
* required key [price] not found", "causingExceptions": [] } ] }
180181
*
181182
* The expected contents are then compared against the actual validation failures reported in the
182183
* ValidationException and nested causingExceptions.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"type": "object",
3+
"id": "urn:jsonschema:com:zzzzz:tests:commons:jsonschema:models:Person",
4+
"properties":
5+
{
6+
"book":
7+
{
8+
"type": "object",
9+
"id": "urn:jsonschema:com:zzzzz:tests:commons:jsonschema:models:PhoneBook",
10+
"properties":
11+
{
12+
"numbers":
13+
{
14+
"type": "array",
15+
"items":
16+
{
17+
"type": "object",
18+
"id": "urn:jsonschema:com:zzzzz:tests:commons:jsonschema:models:PhoneNumber",
19+
"properties":
20+
{
21+
"number":
22+
{
23+
"type": "string",
24+
"pattern": "\\+?\\d+"
25+
},
26+
27+
"type":
28+
{
29+
"type": "string"
30+
}
31+
}
32+
}
33+
}
34+
}
35+
},
36+
"phoneBooks": {
37+
"type": "array",
38+
"items": {
39+
"type": "object",
40+
"$ref": "urn:jsonschema:com:zzzzz:tests:commons:jsonschema:models:PhoneBook"
41+
}
42+
}
43+
}
44+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"book":
3+
{
4+
"numbers":
5+
[
6+
{
7+
"number": "22222"
8+
},
9+
10+
{
11+
"number": "11111"
12+
}
13+
]
14+
},
15+
16+
"phoneBooks":
17+
[
18+
{
19+
"numbers":
20+
[
21+
{
22+
"number": "22222"
23+
},
24+
25+
{
26+
"number": "11111"
27+
},
28+
29+
{
30+
"number": "aaaaa"
31+
}
32+
]
33+
}
34+
]
35+
}

0 commit comments

Comments
 (0)