Search in sources :

Example 6 with CodecPrintWriter

use of org.grails.buffer.CodecPrintWriter in project grails-core by grails.

the class MockGrailsApplication method testPrintStreamCharBufferWithClosure.

@Test
public void testPrintStreamCharBufferWithClosure() throws IOException {
    FastStringWriter stringwriter = new FastStringWriter();
    CodecPrintWriter writer = new CodecPrintWriter(stringwriter, getEncoder(new MockGrailsApplication(), CodecWithClosureProperties.class), registry);
    StreamCharBuffer buf = new StreamCharBuffer();
    buf.getWriter().write("hola");
    writer.write(buf);
    writer.flush();
    assertEquals("-> hola <-", stringwriter.getValue());
}
Also used : FastStringWriter(org.grails.buffer.FastStringWriter) CodecPrintWriter(org.grails.buffer.CodecPrintWriter) StreamCharBuffer(org.grails.buffer.StreamCharBuffer) Test(org.junit.Test)

Aggregations

CodecPrintWriter (org.grails.buffer.CodecPrintWriter)6 FastStringWriter (org.grails.buffer.FastStringWriter)5 Test (org.junit.Test)5 StreamCharBuffer (org.grails.buffer.StreamCharBuffer)2 HTMLCodec (org.grails.plugins.codecs.HTMLCodec)2 GroovyObject (groovy.lang.GroovyObject)1 GrailsPrintWriter (org.grails.buffer.GrailsPrintWriter)1 EncodedAppenderWriterFactory (org.grails.encoder.EncodedAppenderWriterFactory)1 Encoder (org.grails.encoder.Encoder)1 StreamingEncoder (org.grails.encoder.StreamingEncoder)1 StreamingEncoderWriter (org.grails.encoder.StreamingEncoderWriter)1 OutputEncodingStack (org.grails.taglib.encoder.OutputEncodingStack)1 GrailsWebRequest (org.grails.web.servlet.mvc.GrailsWebRequest)1