ServletContext servletContext = new MockServletContext();
HttpServletRequest request = new MockHttpServletRequest();
HttpServletResponse response = new MockHttpServletResponse();
pageContext = new MockPageContext(request);
ExternalContext externalContext =
new MockExternalContext(servletContext, request, response);
Lifecycle lifecycle = null;
facesContext = new MockFacesContext(externalContext, lifecycle);
// Set up Faces API Objects
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
"org.apache.myfaces.tobago.mock.faces.MockApplicationFactory");