/** Should fail gracefully, even in the face of NoSuchMethodError. */ public void testEvaluate() throws Exception { MetawidgetTag metawidget = new HtmlMetawidgetTag(); metawidget.setPageContext( new MockPageContext() { @Override public ExpressionEvaluator getExpressionEvaluator() { return new ExpressionEvaluator() { @SuppressWarnings("rawtypes") @Override public Object evaluate( String expression, Class arg1, VariableResolver arg2, FunctionMapper arg3) { throw new NoSuchMethodError("Should fail gracefully"); } @Override @SuppressWarnings("rawtypes") public Expression parseExpression(String arg0, Class arg1, FunctionMapper arg2) { throw new NoSuchMethodError("Should fail gracefully"); } }; } }); assertEquals(null, HtmlWidgetBuilderUtils.evaluate("${foo}", metawidget)); }
@Override protected void initNestedMetawidget(MetawidgetTag metawidget, Map<String, String> attributes) { super.initNestedMetawidget(metawidget, attributes); BaseHtmlMetawidgetTag tag = (BaseHtmlMetawidgetTag) metawidget; tag.setStyle(mStyle); tag.setStyleClass(mStyleClass); }