Search in sources :

Example 1 with MockFacesContext

use of org.apache.myfaces.test.mock.MockFacesContext in project deltaspike by apache.

the class MockedJsf2TestContainer method initFacesContext.

protected void initFacesContext() {
    FacesContextFactory facesContextFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
    this.facesContext = facesContextFactory.getFacesContext(this.servletContext, this.request, this.response, this.lifecycle);
    ((MockFacesContext) this.facesContext).setApplication(this.application);
    ExceptionHandler exceptionHandler = ((ExceptionHandlerFactory) FactoryFinder.getFactory(FactoryFinder.EXCEPTION_HANDLER_FACTORY)).getExceptionHandler();
    this.facesContext.setExceptionHandler(exceptionHandler);
    ((MockFacesContext) this.facesContext).setExternalContext(new MockExternalContext(this.servletContext, this.request, this.response));
}
Also used : MockFacesContext(org.apache.myfaces.test.mock.MockFacesContext) ExceptionHandler(javax.faces.context.ExceptionHandler) MockExternalContext(org.apache.myfaces.test.mock.MockExternalContext) MockExceptionHandlerFactory(org.apache.myfaces.test.mock.MockExceptionHandlerFactory) ExceptionHandlerFactory(javax.faces.context.ExceptionHandlerFactory) FacesContextFactory(javax.faces.context.FacesContextFactory) MockFacesContextFactory(org.apache.myfaces.test.mock.MockFacesContextFactory)

Aggregations

ExceptionHandler (javax.faces.context.ExceptionHandler)1 ExceptionHandlerFactory (javax.faces.context.ExceptionHandlerFactory)1 FacesContextFactory (javax.faces.context.FacesContextFactory)1 MockExceptionHandlerFactory (org.apache.myfaces.test.mock.MockExceptionHandlerFactory)1 MockExternalContext (org.apache.myfaces.test.mock.MockExternalContext)1 MockFacesContext (org.apache.myfaces.test.mock.MockFacesContext)1 MockFacesContextFactory (org.apache.myfaces.test.mock.MockFacesContextFactory)1