Skip to content

Commit 8dd4ab5

Browse files
committed
add test case for uuisValidator
1 parent b35d50e commit 8dd4ab5

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/test/java/com/networknt/schema/JsonSchemaTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ public void testRequiredValidator() throws Exception {
270270
runTestFile("tests/required.json");
271271
}
272272

273+
273274
@Test
274275
public void testTypeValidator() throws Exception {
275276
runTestFile("tests/type.json");
@@ -300,4 +301,10 @@ public void testSchemaFromClasspath() throws Exception {
300301
runTestFile("tests/classpath/schema.json");
301302
}
302303

304+
305+
306+
@Test
307+
public void testUUIDValidator() throws Exception {
308+
runTestFile("tests/uuid.json");
309+
}
303310
}

src/test/resources/tests/uuid.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[
2+
{
3+
"description": "uuid format validation",
4+
"schema": {"format": "uuid"},
5+
"tests": [
6+
{
7+
"description": "invalid uuid",
8+
"data": "df984f5c-59bd-48e3sac87-b03d574b37e9",
9+
"valid": false
10+
},
11+
{
12+
"description": "valid uuid string",
13+
"data": "df984f5c-59bd-48e3-ac87-b03d574b37e9",
14+
"valid": true
15+
},
16+
{
17+
"description": "too short, it is invalid",
18+
"data": "5fc03087d-d265-11e7-b8c6-83e29cd24f",
19+
"valid": false
20+
},
21+
{
22+
"description": "two long, length is greater than 36",
23+
"data": "5fc03087d-d265-11e7-b8c6-83e29cd24f42333",
24+
"valid": false
25+
}
26+
]
27+
}
28+
]

0 commit comments

Comments
 (0)