mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-10 04:24:31 +08:00
successful test
This commit is contained in:
@@ -73,6 +73,7 @@ import org.json.junit.data.MyJsonString;
|
||||
import org.json.junit.data.MyNumber;
|
||||
import org.json.junit.data.MyNumberContainer;
|
||||
import org.json.junit.data.MyPublicClass;
|
||||
import org.json.junit.data.RecursiveBean;
|
||||
import org.json.junit.data.Singleton;
|
||||
import org.json.junit.data.SingletonEnum;
|
||||
import org.json.junit.data.WeirdList;
|
||||
@@ -3218,6 +3219,14 @@ public class JSONObjectTest {
|
||||
jsonObject.put(null, new Object());
|
||||
fail("Expected an exception");
|
||||
}
|
||||
@Test(expected=JSONException.class)
|
||||
public void testSimpleRecursiveObject() {
|
||||
RecursiveBean ObjA = new RecursiveBean("ObjA");
|
||||
RecursiveBean ObjB = new RecursiveBean("ObjB", ObjA);
|
||||
ObjA.setRef(ObjB);
|
||||
JSONObject jsonObject = new JSONObject(ObjA);
|
||||
fail("Expected an exception");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIssue548ObjectWithEmptyJsonArray() {
|
||||
|
@@ -10,6 +10,7 @@ public class RecursiveBean {
|
||||
private Object reference;
|
||||
public String getName() { return name; }
|
||||
public Object getRef() {return reference;}
|
||||
public void setRef(Object refObj) {reference = refObj;}
|
||||
|
||||
public RecursiveBean(String name) {
|
||||
this.name = name;
|
||||
|
Reference in New Issue
Block a user