示例#1
0
 public void testVersion() throws IOException {
   JSFSession jsfSession = new JSFSession("/index.jsf");
   assertTrue(Environment.is12Compatible());
   assertTrue(Environment.is20Compatible());
   assertEquals(2, Environment.getJSFMajorVersion());
   assertEquals(0, Environment.getJSFMinorVersion());
 }
  protected void validateManagedBeanValueOnIndexPage() throws Exception {
    JSFSession jsfSession = new JSFSession("/index.jsf");
    System.out.println(
        "GET /index.jsf HTTP/1.1\n\n" + jsfSession.getJSFClientSession().getPageAsText());
    assertTrue(Environment.is12Compatible());
    assertTrue(Environment.is20Compatible());
    assertEquals(2, Environment.getJSFMajorVersion());
    assertEquals(0, Environment.getJSFMinorVersion());

    JSFServerSession server = jsfSession.getJSFServerSession();

    assertEquals("42", server.getManagedBeanValue("#{hitchhikersGuide.ultimateAnswer}"));
    assertEquals(
        ProjectStage.Development, server.getManagedBeanValue("#{hitchhikersGuide.journeyStage}"));
    assertEquals(
        ProjectStage.Development, server.getFacesContext().getApplication().getProjectStage());
  }