/**
* Test method for {@link org.ajax4jsf.webapp.CacheContent#getOutputStream(java.io.OutputStream)}.
* @throws IOException
*/
public void testGetOutputStream() throws IOException {
CacheContent content = new CacheContent();
OutputStream outputStream = content.getOutputStream();
byte[] bytes = "Test".getBytes();
outputStream.write(bytes);
outputStream.flush();
outputStream.close();
ByteArrayOutputStream ser = new ByteArrayOutputStream(1024);
ObjectOutputStream objStream = new ObjectOutputStream(ser);
objStream.writeObject(content);
objStream.flush();
ByteArrayInputStream in = new ByteArrayInputStream(ser.toByteArray());
ObjectInputStream objInput = new ObjectInputStream(in);
try {
content = (CacheContent) objInput.readObject();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
content.send(this.response);
MockServletOutputStream mockStream = (MockServletOutputStream) response.getOutputStream();
byte[] bs = mockStream.content();
assertEquals("Test", new String(bs));
}