mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
Bad XML
This commit is contained in:
parent
90e62b0e1b
commit
3e3951f125
13
Test.java
13
Test.java
@ -40,7 +40,7 @@ SOFTWARE.
|
||||
* comparisons of .toString to a string literal are likely to fail.
|
||||
*
|
||||
* @author JSON.org
|
||||
* @version 2011-10-03
|
||||
* @version 2011-10-05
|
||||
*/
|
||||
public class Test extends TestCase {
|
||||
public Test(String name) {
|
||||
@ -81,7 +81,7 @@ public class Test extends TestCase {
|
||||
}
|
||||
|
||||
public void testJSON() throws Exception {
|
||||
double eps = 2.220446049250313e-16;
|
||||
double eps = 2.220446049250313e-16;
|
||||
Iterator iterator;
|
||||
JSONArray jsonarray;
|
||||
JSONObject jsonobject;
|
||||
@ -838,6 +838,15 @@ public class Test extends TestCase {
|
||||
assertEquals("Mismatched 'right' and 'wrong' at 15 [character 16 line 1]", jsone.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
string = "This ain't XML.";
|
||||
jsonarray = JSONML.toJSONArray(string);
|
||||
System.out.println(jsonarray.toString(4));
|
||||
fail("expecting JSONException here.");
|
||||
} catch (JSONException jsone) {
|
||||
assertEquals("Bad XML at 17 [character 18 line 1]", jsone.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
string = "{\"koda\": true, \"koda\": true}";
|
||||
jsonobject = new JSONObject(string);
|
||||
|
Loading…
x
Reference in New Issue
Block a user