001    package com.mockrunner.base;
002    
003    import com.mockrunner.mock.web.WebMockObjectFactory;
004    
005    /**
006     * Generic implementation of {@link HTMLOutputModule}.
007     * Can be used to to test HTML output in modules that
008     * do not extend {@link HTMLOutputModule}.
009     */
010    public class GenericHTMLOutputModule extends HTMLOutputModule
011    {
012        private WebMockObjectFactory factory;
013        
014        public GenericHTMLOutputModule(WebMockObjectFactory factory)
015        {
016            super(factory);
017            this.factory = factory;
018        }
019        
020        public String getOutput()
021        {
022            try
023            {
024                factory.getMockResponse().getWriter().flush();    
025            }
026            catch(Exception exc)
027            {
028            
029            }
030            return factory.getMockResponse().getOutputStreamContent();
031        }
032    }