Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues 400, 482, 487: Allow comma in the quoted string (#747)
Co-authored-by: Leonid Malikov <leonid@percival.co.uk>
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
json-path/src/test/java/com/jayway/jsonpath/Issue_487.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.jayway.jsonpath; | ||
|
||
import org.junit.Test; | ||
|
||
public class Issue_487 { | ||
|
||
public static final Configuration jsonConf = Configuration.defaultConfiguration(); | ||
|
||
@Test//(expected = InvalidPathException.class) | ||
public void test_read_with_comma_1(){ // originally throws InvalidPathException | ||
DocumentContext dc = JsonPath.using(jsonConf) | ||
.parse("{ \"key,\" : \"value\" }"); | ||
Object ans = dc.read(JsonPath.compile("$['key,']")); | ||
//System.out.println(ans); | ||
assert(ans.toString().equals("value")); | ||
} | ||
|
||
@Test | ||
public void test_read_with_comma_2(){ // originally passed | ||
DocumentContext dc = JsonPath.using(jsonConf) | ||
.parse("{ \"key,\" : \"value\" }"); | ||
Object ans = dc.read(JsonPath.compile("$['key\\,']")); | ||
//System.out.println(ans); | ||
assert(ans.toString().equals("value")); | ||
} | ||
} |