@Test public void testJsonEscape() {

  WriteBuffer buffer = new WriteBuffer(buf, 0);
  jsonEscape(new String(new char[] {0, 'a', 1}), buffer);
  assertThat(buffer).hasToString("\\u0000a\\u0001");
  buffer.pos = 0;
  jsonEscape(new String(new char[] {'"', '\\', '\t', '\b'}), buffer);
  assertThat(buffer).hasToString("\\\"\\\\\\t\\b");
  buffer.pos = 0;
  jsonEscape(new String(new char[] {'\n', '\r', '\f'}), buffer);
  assertThat(buffer).hasToString("\\n\\r\\f");
  buffer.pos = 0;
  jsonEscape("\u2028 and \u2029", buffer);
  assertThat(buffer).hasToString("\\u2028 and \\u2029");
  buffer.pos = 0;
  jsonEscape("\"foo", buffer);
  assertThat(buffer).hasToString("\\\"foo");
}