final WidgetChain targetWidgetChain = new ProceedingWidgetChain();
//noinspection unchecked
targetWidgetChain.addWidget(new XmlWidget(new ProceedingWidgetChain()
.addWidget(new IncludeWidget(new TerminalWidgetChain(), "'me'", evaluator)),
"p", new MvelEvaluatorCompiler(Object.class), new LinkedHashMap<String, String>() {{
put("class", "pretty");
put("id", "a-p-tag");
}}));
widget.addWidget(new ShowIfWidget(targetWidgetChain, "true", evaluator));
Renderable bodyWrapper = new XmlWidget(widget, "body", createMock(EvaluatorCompiler.class), Collections.<String, String>emptyMap());
expect(pageBook.forName(targetPageName))
.andReturn(page);
//mypage does?
final MyEmbeddedPage myEmbeddedPage = new MyEmbeddedPage();
expect(page.instantiate())
.andReturn(myEmbeddedPage);
expect(page.doMethod(isA(String.class), anyObject(), isA(String.class),
isA(Request.class)))
.andReturn(null);
expect(page.widget())
.andReturn(bodyWrapper);
replay(pageBook, page);
//create embedding arguments
final String includeExpr = "me";
Map<String, ArgumentWidget> inners = new HashMap<String, ArgumentWidget>();
inners.put(includeExpr, new ArgumentWidget(new ProceedingWidgetChain().addWidget(new TextWidget(HELLO_FROM_INCLUDE, new MvelEvaluatorCompiler(Object.class))),
includeExpr, evaluator));
final EmbedWidget embedWidget = new EmbedWidget(inners, expression, evaluator, pageBook, targetPageName);
embedWidget.init(new EmbeddedRespondFactory(), HtmlTemplateCompilerTest.mockRequestProviderForContext());