@Test
public void testValidStrings() throws ScriptException, NoSuchMethodException
{

    int[] codePoints = new int[32768];
    JSONConfig cfg = new JSONConfig();
    JsonObject jsonObj = new JsonObject(1, cfg);
    int j = 0;
    for ( int i = 0; i <= Character.MAX_CODE_POINT; i++ ){
        if ( isNormalCodePoint(i) ){
            // 247650 code points, the last time I checked.
            codePoints[j++] = i;
            if ( j == codePoints.length ){
                jsonObj.clear();
                jsonObj.add("x", new String(codePoints,0,j));
                String json = jsonObj.toJSON();
                validateJSON(json);
                j = 0;
            }
        }
    }
    if ( j > 0 ){
        jsonObj.clear();
        jsonObj.add("x", new String(codePoints,0,j));
        String json = jsonObj.toJSON();
        validateJSON(json);
    }
    jsonObj.clear();
    jsonObj.add("x", "Some data\nSome other data.");
    String json = jsonObj.toJSON();
    validateJSON(json);
    assertThat(json, is("{\"x\":\"Some data\\nSome other data.\"}"));
}