Skip to content

Commit e748c60

Browse files
committed
tests for improved failure handling
1 parent f857dda commit e748c60

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/test/org/json/junit/JSONPointerTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,14 @@ public void syntaxError() {
9494
new JSONPointer("key");
9595
}
9696

97+
@Test(expected = JSONPointerException.class)
98+
public void arrayIndexFailure() {
99+
query("/foo/2");
100+
}
101+
102+
@Test(expected = JSONPointerException.class)
103+
public void primitiveFailure() {
104+
query("/obj/key/failure");
105+
}
106+
97107
}

src/test/org/json/junit/jsonpointer-testdoc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@
1212
"i\\j": 5,
1313
"k\"l": 6,
1414
" ": 7,
15-
"m~n": 8
15+
"m~n": 8,
16+
"obj" : {
17+
"key" : "value"
18+
}
1619
}

0 commit comments

Comments
 (0)