### Question:
FacesElUtils { public Object invokeMethod(final FacesContext context, final String expression) throws ELException { MethodBinding methodBinding = context.getApplication().createMethodBinding(expression, null); return methodBinding.invoke(context, null); }  boolean isEl(final String viewId); Object invokeMethod(final FacesContext context, final String expression); void setValue(final FacesContext context, final String expression, final Object value); Object getValue(final FacesContext context, final String expression); Class<?> getExpectedType(final FacesContext context, final String expression); static final String EL_REGEX; static final Pattern elPattern; }### Answer:
@Test public void testCallElMethodWithNoArguments() throws SecurityException, NoSuchMethodException { FacesContext context = createMock(FacesContext.class, new Method[] { FacesContext.class.getMethod("getApplication") }); Application application = createMock(Application.class, new Method[] { Application.class.getMethod("createMethodBinding", String.class, Class[].class) }); MethodBinding methodBinding = createMock(MethodBinding.class); String expression = "aGivenExpression"; expect(context.getApplication()).andReturn(application); expect(application.createMethodBinding(expression, null)).andReturn(methodBinding); expect(methodBinding.invoke(context, null)).andReturn(new Object()); replay(context, application, methodBinding); FacesElUtils facesElUtils = new FacesElUtils(); facesElUtils.invokeMethod(context, expression); verify(context); }