Package org.springframework.faces.webflow

Source Code of org.springframework.faces.webflow.JsfAjaxHandlerTests

package org.springframework.faces.webflow;

import junit.framework.TestCase;

import org.springframework.web.context.support.StaticWebApplicationContext;

public class JsfAjaxHandlerTests extends TestCase {

  private final JSFMockHelper jsfMock = new JSFMockHelper();
  private JsfAjaxHandler ajaxHandler;

  protected void setUp() throws Exception {
    this.jsfMock.setUp();
    StaticWebApplicationContext webappContext = new StaticWebApplicationContext();
    webappContext.setServletContext(this.jsfMock.servletContext());
    this.ajaxHandler = new JsfAjaxHandler();
    this.ajaxHandler.setApplicationContext(webappContext);
  }

  protected void tearDown() throws Exception {
    this.jsfMock.tearDown();
  }

  public void testSendAjaxRedirect() throws Exception {
    this.ajaxHandler.sendAjaxRedirectInternal("/target", this.jsfMock.request(), this.jsfMock.response(), false);
    assertTrue(this.jsfMock.contentAsString().matches("<partial-response.*><redirect url=\"/target\"/></partial-response>"));
    assertEquals("application/xml", this.jsfMock.response().getContentType());
  }

}
TOP

Related Classes of org.springframework.faces.webflow.JsfAjaxHandlerTests

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.