WidMVELEvaluator { public static Object eval(final String expression) { ExpressionCompiler compiler = new ExpressionCompiler(getRevisedExpression(expression), WID_PARSER_CONTEXT); if(KiePolicyHelper.isPolicyEnabled()) { return AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { return MVEL.executeExpression(compiler.compile(), new HashMap()); } }, KiePolicyHelper.getAccessContext()); } else { return MVEL.executeExpression(compiler.compile(), new HashMap()); } }  static Object eval(final String expression); static ParserContext WID_PARSER_CONTEXT; static final String DATA_TYPE_PACKAGE; }
@Test public void testWidNoImports() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-noimports.wid"))); }
@Test public void testWidBackwardsCompatImports() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-backwardscompat.wid"))); }
@Test public void testWidBackwardsCompatPkgImports() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-backwardscompatpkgimport.wid"))); }
@Test public void testWidBackwardsCompatMixedAndMissingImports() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-backwardscompatmixedandmissingimports.wid"))); }
@Test public void testWidCustomDataType() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-customdatatype.wid"))); }
@Test public void testWidCustomDataTypeNoImport() { try { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-customdatatypenoimport.wid"))); } catch(Throwable t) { assertTrue(t instanceof CompileException); } }