@Test
public void testEscapeUndefined()
{

    JSONConfig cfg = new JSONConfig().setUseECMA6(false).setBadCharacterPolicy(JSONConfig.ESCAPE);
    Random rand = new Random();
    for ( int i = 0; i <= BAD_CHARS; i++ ){
        int cp = getRandomUndefined(rand);
        String escape;
        if ( cp < Character.MIN_SUPPLEMENTARY_CODE_POINT ){
            escape = String.format("\\u%04X", cp);
        }else{
            escape = String.format("\\u%04X\\u%04X", (int)Character.highSurrogate(cp), (int)Character.lowSurrogate(cp));
        }
        assertThat(JSONUtil.toJSON(undefinedTestMap(cp), cfg), is(makeResult(escape)));
    }
}