Search in sources :

Example 1 with MockApplication

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

the class FacesLoggerTest method unresolvedNavigationGermany.

@Test
public void unresolvedNavigationGermany() {
    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.GERMANY);
    facesContext.setViewRoot(root);
    final Object[] params = { "componentId1", "outcome.xhtml", "viewId.xhtml" };
    Locale.setDefault(new Locale("de", "DE"));
    final String result = FacesLogger.RENDERKIT.interpolateMessage(facesContext, "faces.outcometarget.navigation.case.not.resolved", params);
    Assert.assertEquals("JSF1090: Navigations-Fall wurde für Komponente componentId1 nicht aufgelöst.", 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)

Example 2 with MockApplication

use of com.sun.faces.mock.MockApplication 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

MockApplication (com.sun.faces.mock.MockApplication)2 MockFacesContext (com.sun.faces.mock.MockFacesContext)2 ELContext (jakarta.el.ELContext)2 UIViewRoot (jakarta.faces.component.UIViewRoot)2 Locale (java.util.Locale)2 Test (org.junit.Test)2