@Test
public void remove() {

    JSONObject o = new JSONObject(of("foo","bar"));
    JSONArray array = new JSONArray(asList(1, o));
    Object remove = array.remove(1);
    assertTrue(remove instanceof JSONObject);
    assertEquals(o, remove);
    assertEquals(1, array.length());
    assertEquals(null, array.remove(55));
}