Package ign.middleman.controllers

Examples of ign.middleman.controllers.SendServerHeader


*/

public class SendServerHeaderTest {
    @Test
    public void initServerTest() throws ServletException {
        SendServerHeader ssh = new SendServerHeader();
        String host = ssh.host;
        ssh.init(null);
        assertNotSame(host, ssh.host);
    }
View Full Code Here


    @Test
    public void initExceptionTest() throws ServletException {

        //we orverride the thisHost to simulate UnknownHostException
        SendServerHeader ssh = new SendServerHeader() {
            @Override
            String thisHost() throws UnknownHostException {
                throw new UnknownHostException();
            }
        };
        assertNull(ssh.host);
        ssh.init(null);
        assertEquals("localhost", ssh.host);
    }
View Full Code Here

        assertEquals("localhost", ssh.host);
    }

    @Test
    public void testDoFilter() throws Exception {
        SendServerHeader ssh = new SendServerHeader();
        ssh.init(null);
        HttpServletRequest request = createMock(HttpServletRequest.class);
        HttpServletResponse response = createMock(HttpServletResponse.class);
        FilterChain chain = createMock(FilterChain.class);
        response.setHeader("X-Via-Server", ssh.host);
        response.setHeader("Via", "Middleman/1.0");
        chain.doFilter(request, response);
        replay(request, response, chain);
        ssh.doFilter(request, response, chain);
    }
View Full Code Here

TOP

Related Classes of ign.middleman.controllers.SendServerHeader

Copyright © 2018 www.massapicom. 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.