Skip to content

Commit 4840a51

Browse files
author
Bence Erős
committed
addressing PR comment
1 parent 824fc54 commit 4840a51

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import static org.hamcrest.MatcherAssert.assertThat;
99
import static org.junit.jupiter.api.Assertions.assertEquals;
1010
import static org.junit.jupiter.api.Assertions.assertSame;
11+
import static org.junit.jupiter.api.Assertions.assertThrows;
1112
import static org.junit.jupiter.api.Assertions.fail;
1213
import static org.mockito.Mockito.mock;
1314
import static org.mockito.Mockito.when;
@@ -99,12 +100,10 @@ void remoteDocumentSuccess() throws URISyntaxException {
99100
void remoteDocument_jsonParsingFailure() {
100101
SchemaClient schemaClient = mock(SchemaClient.class);
101102
when(schemaClient.get("http://localhost:1234/hello")).thenReturn(asStream("unparseable"));
102-
try {
103-
JsonPointerEvaluator.forURL(schemaClient, "http://localhost:1234/hello#/foo", createLoadingState(schemaClient, "")).query();
104-
fail("did not throw exception for unparseable json");
105-
} catch (SchemaException e) {
106-
assertEquals("http://localhost:1234/hello", e.getSchemaLocation());
107-
}
103+
SchemaException actual = assertThrows(SchemaException.class,
104+
() -> JsonPointerEvaluator.forURL(schemaClient, "http://localhost:1234/hello#/foo", createLoadingState(schemaClient, "")).query()
105+
);
106+
assertEquals("http://localhost:1234/hello", actual.getSchemaLocation());
108107
}
109108

110109
@Test

0 commit comments

Comments
 (0)