Search in sources :

Example 1 with LoggingAdvisingAppendable

use of com.google.template.soy.data.LoggingAdvisingAppendable in project closure-templates by google.

the class SanitizersTest method testFilterNoAutoescapeStreamingText.

@Test
public void testFilterNoAutoescapeStreamingText() throws IOException {
    BufferingAppendable buffer = LoggingAdvisingAppendable.buffering();
    LoggingAdvisingAppendable escapingBuffer = Sanitizers.filterNoAutoescapeStreaming(buffer);
    escapingBuffer.setSanitizedContentKind(ContentKind.TEXT);
    assertThat(buffer.getAndClearBuffer()).isEqualTo("zSoyz");
    escapingBuffer.append("foo");
    assertThat(buffer.getAndClearBuffer()).isEmpty();
}
Also used : BufferingAppendable(com.google.template.soy.data.LoggingAdvisingAppendable.BufferingAppendable) LoggingAdvisingAppendable(com.google.template.soy.data.LoggingAdvisingAppendable) Test(org.junit.Test)

Example 2 with LoggingAdvisingAppendable

use of com.google.template.soy.data.LoggingAdvisingAppendable in project closure-templates by google.

the class SanitizersTest method testFilterNoAutoescapeStreamingNoContentKind.

@Test
public void testFilterNoAutoescapeStreamingNoContentKind() throws IOException {
    BufferingAppendable buffer = LoggingAdvisingAppendable.buffering();
    LoggingAdvisingAppendable escapingBuffer = Sanitizers.filterNoAutoescapeStreaming(buffer);
    escapingBuffer.append("foo");
    assertThat(buffer.getAndClearBuffer()).isEqualTo("foo");
}
Also used : BufferingAppendable(com.google.template.soy.data.LoggingAdvisingAppendable.BufferingAppendable) LoggingAdvisingAppendable(com.google.template.soy.data.LoggingAdvisingAppendable) Test(org.junit.Test)

Example 3 with LoggingAdvisingAppendable

use of com.google.template.soy.data.LoggingAdvisingAppendable in project closure-templates by google.

the class SanitizersTest method testFilterNoAutoescapeStreamingHtml.

@Test
public void testFilterNoAutoescapeStreamingHtml() throws IOException {
    BufferingAppendable buffer = LoggingAdvisingAppendable.buffering();
    LoggingAdvisingAppendable escapingBuffer = Sanitizers.filterNoAutoescapeStreaming(buffer);
    escapingBuffer.setSanitizedContentKind(ContentKind.HTML);
    escapingBuffer.append("foo");
    assertThat(buffer.getAndClearBuffer()).isEqualTo("foo");
}
Also used : BufferingAppendable(com.google.template.soy.data.LoggingAdvisingAppendable.BufferingAppendable) LoggingAdvisingAppendable(com.google.template.soy.data.LoggingAdvisingAppendable) Test(org.junit.Test)

Aggregations

LoggingAdvisingAppendable (com.google.template.soy.data.LoggingAdvisingAppendable)3 BufferingAppendable (com.google.template.soy.data.LoggingAdvisingAppendable.BufferingAppendable)3 Test (org.junit.Test)3