001    package com.mockrunner.mock.web;
002    
003    import javax.servlet.jsp.el.ELException;
004    import javax.servlet.jsp.el.Expression;
005    import javax.servlet.jsp.el.ExpressionEvaluator;
006    import javax.servlet.jsp.el.FunctionMapper;
007    import javax.servlet.jsp.el.VariableResolver;
008    
009    /**
010     * Mock implementation of <code>Expression</code>.
011     */
012    public class MockExpression extends Expression
013    {
014        private ExpressionEvaluator evaluator;
015        private String expression;
016        private Class expectedType;
017        private FunctionMapper mapper;
018        
019        public MockExpression(ExpressionEvaluator evaluator, String expression, Class expectedType, FunctionMapper mapper)
020        {
021            this.evaluator = evaluator;
022            this.expression = expression;
023            this.expectedType = expectedType;
024            this.mapper = mapper;
025        }
026    
027        public Object evaluate(VariableResolver resolver) throws ELException
028        {
029            return evaluator.evaluate(expression, expectedType, resolver, mapper);
030        }
031    }