Search in sources :

Example 6 with MockFacesContext

use of com.sun.faces.mock.MockFacesContext in project mojarra by eclipse-ee4j.

the class FacesLoggerTest method unresolvedNavigationUS.

@Test
public void unresolvedNavigationUS() {
    MockFacesContext facesContext = new MockFacesContext();
    facesContext.setApplication(new MockApplication());
    facesContext.setELContext(EasyMock.createMock(ELContext.class));
    UIViewRoot root = facesContext.getApplication().getViewHandler().createView(facesContext, null);
    root.setLocale(Locale.US);
    facesContext.setViewRoot(root);
    final Object[] params = { "componentId1", "outcome.xhtml", "viewId.xhtml" };
    Locale.setDefault(new Locale("en", "US"));
    final String result = FacesLogger.RENDERKIT.interpolateMessage(facesContext, "faces.outcometarget.navigation.case.not.resolved", params);
    Assert.assertEquals("JSF1090: Navigation case outcome.xhtml not resolved for component componentId1 in viewId viewId.xhtml", result);
}
Also used : MockFacesContext(com.sun.faces.mock.MockFacesContext) Locale(java.util.Locale) ELContext(jakarta.el.ELContext) MockApplication(com.sun.faces.mock.MockApplication) UIViewRoot(jakarta.faces.component.UIViewRoot) Test(org.junit.Test)

Aggregations

MockFacesContext (com.sun.faces.mock.MockFacesContext)6 MockLifecycle (com.sun.faces.mock.MockLifecycle)4 MockExternalContext (com.sun.faces.mock.MockExternalContext)3 MockHttpServletRequest (com.sun.faces.mock.MockHttpServletRequest)3 MockHttpServletResponse (com.sun.faces.mock.MockHttpServletResponse)3 MockServletContext (com.sun.faces.mock.MockServletContext)3 Test (org.junit.Test)3 MockApplication (com.sun.faces.mock.MockApplication)2 ELContext (jakarta.el.ELContext)2 UIViewRoot (jakarta.faces.component.UIViewRoot)2 Locale (java.util.Locale)2 ClassMethodSignature (com.newrelic.agent.tracers.ClassMethodSignature)1 Tracer (com.newrelic.agent.tracers.Tracer)1 Trace (com.newrelic.api.agent.Trace)1 Phase (com.sun.faces.lifecycle.Phase)1 MockHttpSession (com.sun.faces.mock.MockHttpSession)1 MockServletConfig (com.sun.faces.mock.MockServletConfig)1 ApplicationFactory (jakarta.faces.application.ApplicationFactory)1 FacesContextFactory (jakarta.faces.context.FacesContextFactory)1 LifecycleFactory (jakarta.faces.lifecycle.LifecycleFactory)1