@SmallTest @MediumTest @LargeTest public void testCollectionPutOfWrapperPutsJSONObject() throws JSONException { JSONObject jsonObject = new JSONObject(); GraphObject graphObject = GraphObject.Factory.create(jsonObject); graphObject.setProperty("hello", "world"); graphObject.setProperty("hocus", "pocus"); GraphObjectList<GraphObject> parentList = GraphObject.Factory.createList(GraphObject.class); parentList.add(graphObject); JSONArray jsonArray = parentList.getInnerJSONArray(); Object obj = jsonArray.opt(0); assertNotNull(obj); assertEquals(jsonObject, obj); parentList.set(0, graphObject); obj = jsonArray.opt(0); assertNotNull(obj); assertEquals(jsonObject, obj); }
@SmallTest @MediumTest @LargeTest public void testCanSetRandomAccess() throws JSONException { JSONArray jsonArray = new JSONArray(); GraphObjectList<String> collection = GraphObject.Factory.createList(jsonArray, String.class); collection.add("Seattle"); collection.add("Menlo Park"); collection.set(1, "Ann Arbor"); assertEquals("Ann Arbor", collection.get(1)); }