Skip to content

Commit 810ac68

Browse files
committed
Using new methods to validate
1 parent f12ee56 commit 810ac68

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/vanilla/src/main/java/org/everit/json/schema/CustomTypeTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import static org.everit.json.schema.FormatValidator.NONE;
1616

1717
import java.util.Objects;
18+
import java.util.HashMap;
1819

1920
import org.everit.json.schema.internal.JSONPrinter;
2021
import org.everit.json.schema.regexp.JavaUtilRegexpFactory;
@@ -39,13 +40,11 @@ public void validateCustomType() throws IOException {
3940
IOUtils.toString(
4041
new InputStreamReader(getClass().getResourceAsStream("/org/everit/json/schema/customType/fails.json")))
4142
));
42-
43-
SchemaLoader.SchemaLoaderBuilder loaderBuilder = SchemaLoader.builder();
44-
loaderBuilder.addCustomType("customType",CustomTestSchema.class);
45-
//loaderBuilder.schemaJson(jsonSchema);
46-
SchemaLoader sLoader = loaderBuilder.build();
4743

48-
Schema schema = sLoader.load(jsonSchema);
44+
// An easy way to register the custom types
45+
HashMap<String,AbstractCustomTypeSchema> customTypes = new HashMap<>();
46+
customTypes.put("customType",CustomTestSchema.class);
47+
Schema schema = SchemaLoader.load(jsonSchema,customTypes);
4948

5049
schema.validate(worksJson);
5150
schema.validate(failsJson);

0 commit comments

Comments
 (0)