Package org.geoserver.util

Source Code of org.geoserver.util.PartialBufferOutputStream2Test

package org.geoserver.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import org.vfny.geoserver.util.PartialBufferedOutputStream2;

import com.mockrunner.mock.web.MockHttpServletResponse;

import junit.framework.TestCase;

public class PartialBufferOutputStream2Test extends TestCase {

    public void testFlushOnClose() throws IOException  {
        MockHttpServletResponse mockResponse = new MockHttpServletResponse();
        PartialBufferedOutputStream2 pbos = new PartialBufferedOutputStream2(mockResponse);
        PrintStream ps = new PrintStream(pbos);
        ps.print("Hello world!");
        ps.close();
       
        // check the in memory buffer has been flushed to the target output stream
        // close
        assertEquals("Hello world!", mockResponse.getOutputStreamContent());
    }
}
TOP

Related Classes of org.geoserver.util.PartialBufferOutputStream2Test

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.