}
public void testImplicitObjects() {
VariableResolver variableResolver =
getFacesContext().getApplication().getVariableResolver();
Object result = null;
//
// test scope maps
//
// ApplicationMap
assertTrue(variableResolver.resolveVariable(getFacesContext(),
"applicationScope") ==
getFacesContext().getExternalContext().getApplicationMap());
// SessionMap
assertTrue(variableResolver.resolveVariable(getFacesContext(),
"sessionScope") ==
getFacesContext().getExternalContext().getSessionMap());
// RequestMap
assertTrue(variableResolver.resolveVariable(getFacesContext(),
"requestScope") ==
getFacesContext().getExternalContext().getRequestMap());
//
// test request objects
//
// cookie
assertTrue(variableResolver.resolveVariable(getFacesContext(),
"cookie") ==
getFacesContext().getExternalContext().getRequestCookieMap());
// header
assertTrue(variableResolver.resolveVariable(getFacesContext(),
"header") ==
getFacesContext().getExternalContext().getRequestHeaderMap());
// headerValues
assertTrue(
variableResolver.resolveVariable(getFacesContext(),
"headerValues") ==
getFacesContext().getExternalContext().getRequestHeaderValuesMap());
// parameter
assertTrue(variableResolver.resolveVariable(getFacesContext(),
"param") ==
getFacesContext().getExternalContext()
.getRequestParameterMap());
// parameterValues
assertTrue(
variableResolver.resolveVariable(getFacesContext(),
"paramValues") ==
getFacesContext().getExternalContext()
.getRequestParameterValuesMap());
//
// misc
//
// initParameter
assertTrue(variableResolver.resolveVariable(getFacesContext(),
"initParam") ==
getFacesContext().getExternalContext().getInitParameterMap());
// facesContext
assertTrue(variableResolver.resolveVariable(getFacesContext(),
"facesContext") ==
getFacesContext());
// tree
// create a dummy root for the tree.
UIViewRoot page = Util.getViewHandler(getFacesContext()).createView(getFacesContext(), null);
page.setId("root");
page.setViewId("newTree");
page.setLocale(Locale.US);
getFacesContext().setViewRoot(page);
assertTrue(variableResolver.resolveVariable(getFacesContext(),
"view") ==
getFacesContext().getViewRoot());
}