@Test
public void remove() {

    JSONObject obj = new JSONObject("{\"foo\": 42, \"bar\": true}");
    assertEquals(42, obj.remove("foo"));
    assertNull(obj.remove("nothing"));
    assertEquals("{\"bar\":true}", obj.toString());
}