@Test(expected = IOException.class)
public void testEvaluateWriterException() throws JspException, IOException {

    PageContext pageContext = createMock(PageContext.class);
    JspFragment body = createMock(JspFragment.class);
    JspWriter writer = createMock(JspWriter.class);
    expect(pageContext.getOut()).andReturn(null);
    body.invoke(writer);
    expectLastCall().andThrow(new JspException());
    replay(body, pageContext, writer);
    try {
        JspModelBody modelBody = new JspModelBody(body, pageContext);
        modelBody.evaluate(writer);
    } finally {
        verify(body, pageContext, writer);
    }
}