Skip to content

Commit e669256

Browse files
committed
test error handling
1 parent 5d87933 commit e669256

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

core/src/test/java/org/everit/json/schema/loader/ClassPathAwareSchemaClientTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
import static org.mockito.Mockito.when;
88

99
import java.io.InputStream;
10+
import java.io.UncheckedIOException;
1011

1112
import org.everit.json.schema.ResourceLoader;
1213
import org.json.JSONObject;
1314
import org.json.JSONTokener;
1415
import org.junit.Before;
16+
import org.junit.Rule;
1517
import org.junit.Test;
18+
import org.junit.rules.ExpectedException;
1619
import org.junit.runner.RunWith;
1720

1821
import junitparams.JUnitParamsRunner;
@@ -39,6 +42,18 @@ public void delegatesUnhandledProtocolsToFallback() {
3942
assertSame(expected, actual);
4043
}
4144

45+
@Rule
46+
public ExpectedException exception = ExpectedException.none();
47+
@Test
48+
public void throwsErrorOnMissingClasspathResource() {
49+
exception.expect(UncheckedIOException.class);
50+
exception.expectMessage("Could not find");
51+
52+
String url = "classpath:/bogus.json";
53+
ClassPathAwareSchemaClient subject = new ClassPathAwareSchemaClient(fallbackClient);
54+
subject.get(url);
55+
}
56+
4257
@Test
4358
@Parameters({
4459
"classpath:/org/everit/jsonvalidator/constobject.json",

0 commit comments

Comments
 (0)