ContextInternals.setMarinerPageContext(requestContext, pageContext);
protocol.setMarinerPageContext(pageContext);
// pane setup required by BlockElementImpl#exprElementStart
Pane testPane =
new Pane(new CanvasLayout());
final String pane = "testPane";
testPane.setName(pane);
pageContext.addPaneMapping(testPane);
pageContext.setCurrentPane(testPane);
TestDeviceLayoutContext deviceLayoutContext =
new TestDeviceLayoutContext();
PaneInstance paneInstance = new TestPaneInstance();
paneInstance.setFormat(testPane);
paneInstance.setDeviceLayoutContext(deviceLayoutContext);
deviceLayoutContext.setFormatInstance(testPane,
NDimensionalIndex.ZERO_DIMENSIONS, paneInstance);
pageContext.pushDeviceLayoutContext(deviceLayoutContext);
pageContext.setFormatInstance(paneInstance);
final PolicyReferenceResolverMock referenceResolverMock =
new PolicyReferenceResolverMock("referenceResolverMock",
expectations);
referenceResolverMock.expects.resolveQuotedTextExpression(null)
.returns(null).any();
pageContext.setPolicyReferenceResolver(referenceResolverMock);
// set up menu atttributes
MenuAttributes menuAttrs = new MenuAttributes();
final String styleClass = "styleClass";
menuAttrs.setStyleClass(styleClass);
final String id = "id";
menuAttrs.setId(id);
menuAttrs.setPane(pane);
int result = element.elementStart(requestContext, menuAttrs);
assertTrue("Unexpected value returned from MenuElement. Should have" +
"been PROCESS_ELEMENT_BODY.",
result == PAPIElement.PROCESS_ELEMENT_BODY);
// retrieve the menu that was just added to the menuBuilder
final Menu menu = (Menu)PrivateAccessor.getField(
pageContext.getMenuBuilder(), "currentEntity");
assertNotNull("Menu should not be null", menu);
assertEquals("PAPI and Protocol pane names should match",
testPane.getName(), menu.getPane().getStem());
ElementDetails menuElementDetails = menu.getElementDetails();
assertNotNull("Menu ElementDetails should not be null",
menuElementDetails);
assertNotNull("Menu styles should not be null",