@Test
public void escape_directive_default() throws Exception {
getEngine("with_defaultEscape", factory);
TemplateContext ctx = new MappedTemplateContext();
ctx.put("count", new Counter());
ctx.put("object", new MyRenderable("<world name=\"中国\" />"));
String content = templateService.getText("escape/test_escape.vm", ctx);
// original - default html
assertThat(content, containsString("1. <world name="中国" />"));
// html
assertThat(content, containsString("2. <world name="中国" />"));
// javascript
assertThat(content, containsString("3. <world name=\\\"中国\\\" \\/>"));
// html (restored)
assertThat(content, containsString("4. <world name="中国" />"));
// noescape
assertThat(content, containsString("5. <world name=\"中国\" />"));
// url encoding
assertThat(content, containsString("6. %3Cworld+name%3D%22%D6%D0%B9%FA%22+%2F%3E"));
// noescape (restored)
assertThat(content, containsString("7. <world name=\"中国\" />"));
// html (restored)
assertThat(content, containsString("8. <world name="中国" />"));
// original (restored) - default html
assertThat(content, containsString("9. <world name="中国" />"));
assertFalse(ctx.containsKey("_ESCAPE_SUPPORT_TYPE_"));
}