public class MockFacesContext
extends javax.faces.context.FacesContext
Usage:
MockFacesContext facesContext = new MockFacesContext() { public Object evaluateExpressionGet(FacesContext context, String expression, Class expectedType) throws ELException { if ("#{myTestExpression}".equals(expression)) { return myTestResult; } return null; } }; facesContext.setCurrent(); assertNotNull(FacesContext.getCurrentInstance());
Constructor and Description |
---|
MockFacesContext() |
Modifier and Type | Method and Description |
---|---|
void |
addMessage(String clientId,
javax.faces.application.FacesMessage message) |
Object |
evaluateExpressionGet(javax.faces.context.FacesContext context,
String expression,
Class expectedType)
Deprecated.
|
javax.faces.application.Application |
getApplication() |
Iterator<String> |
getClientIdsWithMessages() |
javax.el.ELContext |
getELContext() |
javax.faces.context.ExternalContext |
getExternalContext() |
javax.faces.application.FacesMessage.Severity |
getMaximumSeverity() |
Iterator<javax.faces.application.FacesMessage> |
getMessages() |
Iterator<javax.faces.application.FacesMessage> |
getMessages(String clientId) |
javax.faces.render.RenderKit |
getRenderKit() |
boolean |
getRenderResponse() |
boolean |
getResponseComplete() |
javax.faces.context.ResponseStream |
getResponseStream() |
javax.faces.context.ResponseWriter |
getResponseWriter() |
javax.faces.component.UIViewRoot |
getViewRoot() |
void |
mapExpression(String expr,
Object res) |
void |
mapVariable(String key,
Object value) |
void |
release() |
void |
relieveCurrent() |
void |
renderResponse() |
void |
resetExpressions() |
void |
resetVariables() |
void |
responseComplete() |
void |
setCurrent() |
void |
setResponseStream(javax.faces.context.ResponseStream responseStream) |
void |
setResponseWriter(javax.faces.context.ResponseWriter responseWriter) |
void |
setViewRoot(javax.faces.component.UIViewRoot root) |
getAttributes, getCurrentInstance, getCurrentPhaseId, getExceptionHandler, getMessageList, getMessageList, getNamingContainerSeparatorChar, getPartialViewContext, getResourceLibraryContracts, isPostback, isProcessingEvents, isProjectStage, isReleased, isValidationFailed, setCurrentPhaseId, setExceptionHandler, setProcessingEvents, setResourceLibraryContracts, validationFailed
public void resetVariables()
public void resetExpressions()
public void setCurrent()
public void relieveCurrent()
public javax.faces.application.Application getApplication()
getApplication
in class javax.faces.context.FacesContext
public javax.el.ELContext getELContext()
getELContext
in class javax.faces.context.FacesContext
@Deprecated public Object evaluateExpressionGet(javax.faces.context.FacesContext context, String expression, Class expectedType) throws javax.el.ELException
javax.el.ELException
public void addMessage(String clientId, javax.faces.application.FacesMessage message)
addMessage
in class javax.faces.context.FacesContext
public Iterator<String> getClientIdsWithMessages()
getClientIdsWithMessages
in class javax.faces.context.FacesContext
public javax.faces.context.ExternalContext getExternalContext()
getExternalContext
in class javax.faces.context.FacesContext
public javax.faces.application.FacesMessage.Severity getMaximumSeverity()
getMaximumSeverity
in class javax.faces.context.FacesContext
public Iterator<javax.faces.application.FacesMessage> getMessages()
getMessages
in class javax.faces.context.FacesContext
public Iterator<javax.faces.application.FacesMessage> getMessages(String clientId)
getMessages
in class javax.faces.context.FacesContext
public javax.faces.render.RenderKit getRenderKit()
getRenderKit
in class javax.faces.context.FacesContext
public boolean getRenderResponse()
getRenderResponse
in class javax.faces.context.FacesContext
public boolean getResponseComplete()
getResponseComplete
in class javax.faces.context.FacesContext
public javax.faces.context.ResponseStream getResponseStream()
getResponseStream
in class javax.faces.context.FacesContext
public javax.faces.context.ResponseWriter getResponseWriter()
getResponseWriter
in class javax.faces.context.FacesContext
public javax.faces.component.UIViewRoot getViewRoot()
getViewRoot
in class javax.faces.context.FacesContext
public void release()
release
in class javax.faces.context.FacesContext
public void renderResponse()
renderResponse
in class javax.faces.context.FacesContext
public void responseComplete()
responseComplete
in class javax.faces.context.FacesContext
public void setResponseStream(javax.faces.context.ResponseStream responseStream)
setResponseStream
in class javax.faces.context.FacesContext
public void setResponseWriter(javax.faces.context.ResponseWriter responseWriter)
setResponseWriter
in class javax.faces.context.FacesContext
public void setViewRoot(javax.faces.component.UIViewRoot root)
setViewRoot
in class javax.faces.context.FacesContext
Copyright © 2015 Nuxeo SA. All rights reserved.