mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-06 10:45:23 +08:00
Bad XML
This commit is contained in:
11
Test.java
11
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) {
|
||||
@@ -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);
|
||||
|
Reference in New Issue
Block a user