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

    Map<String,Object> jsonObj = new HashMap<>();
    JSONConfig cfg = new JSONConfig().setUnEscapeWherePossible(false)
                                     .setPassThroughEscapes(true)
                                     .setUseECMA6(true);
    // escapes that get passed through.
    String[] strs = { "\\u1234", "a\\u{41}", "\\\"", "\\/", "\\b", "\\f", "\\n", "\\r", "\\t", "\\\\", "\\v" };
    for ( String str : strs ){
        jsonObj.clear();
        jsonObj.put("x", str);
        String json = JSONUtil.toJSON(jsonObj, cfg);
        String result = "\\v".equals(str) ? "\\u{B}" : str;
        if ( result.indexOf('{') < 0 ){
            // Nashorn doesn't understand ECMAScript 6 code point escapes.
            validateJSON(json);
        }
        assertThat(json, is("{\"x\":\""+result+"\"}"));
    }
    // test it with ECMA6 disabled.
    String str = "a\\u{41}";
    jsonObj.clear();
    jsonObj.put("x", str);
    cfg.setUseECMA6(false);
    String json = JSONUtil.toJSON(jsonObj, cfg);
    validateJSON(json);
    assertThat(json, is("{\"x\":\"aA\"}"));
}