private FacesRequest submit(FacesRequest request) throws MalformedURLException { FacesRequest request2 = request .submit() .withParameter("helloForm:input", "BAZ") .withParameter("helloForm:command", "Ok"); request2.execute(); String content2 = request2.getConnection().getContentAsString(); assertTrue(content2.contains(Bean.TEST_SCRIPT)); return request2; }
@Test public void testRequest() throws Exception { FacesRequest request = environment.createFacesRequest("http://localhost/test.jsf?foo=bar"); assertNotNull(request.execute()); String contentAsString = request.getConnection().getContentAsString(); assertFalse(contentAsString.contains(Bean.TEST_SCRIPT)); FacesRequest request2 = submit(request).submit(); request2.execute(); String content2 = request2.getConnection().getContentAsString(); assertFalse(content2.contains(Bean.TEST_SCRIPT)); }
protected void setUpFacesRequest() { facesRequest.start(); }
protected void tearDownFacesRequest() { if (facesRequest != null) { facesRequest.release(); facesRequest = null; } }