@Test
public void writerIndent() {

    String str = "{\"foo\": 42, \"bar\": true}";
    JSONObject obj = new JSONObject(str);
    StringWriter sw = new StringWriter();
    obj.write(sw, 3, 3);
    assertEquals("{\n" +
            "  \"foo\": 42,\n" +
            "  \"bar\": true\n" +
            "}", sw.toString());
}