1 package com.networknt.schema; 2 3 import static org.hamcrest.CoreMatchers.instanceOf; 4 import static org.hamcrest.MatcherAssert.assertThat; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 import org.junit.jupiter.api.Test; 9 10 public class Issue347Test { 11 12 @Test failure()13 public void failure() { 14 JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7); 15 assertThrows(JsonSchemaException.class, () -> factory.getSchema(Thread.currentThread().getContextClassLoader().getResourceAsStream("schema/issue347-v7.json"))); 16 try { 17 factory.getSchema(Thread.currentThread().getContextClassLoader().getResourceAsStream("schema/issue347-v7.json")); 18 } catch (Throwable e) { 19 assertThat(e, instanceOf(JsonSchemaException.class)); 20 assertEquals("/$id: 'test' is not a valid $id", e.getMessage()); 21 } 22 } 23 } 24