*/
public void testElementStartAddsStyles() throws Throwable {
MenuItemElementImpl element =
(MenuItemElementImpl)createTestablePAPIElement();
TestMarinerPageContext pageContext = new TestMarinerPageContext();
MarinerRequestContext requestContext = new TestMarinerRequestContext();
ProtocolBuilder builder = new ProtocolBuilder();
DOMProtocol protocol = (DOMProtocol) builder.build(
new TestProtocolRegistry.TestDOMProtocolFactory(),
InternalDeviceTestHelper.createTestDevice());
pageContext.pushRequestContext(requestContext);
pageContext.setProtocol(protocol);
ContextInternals.setMarinerPageContext(requestContext, pageContext);
protocol.setMarinerPageContext(pageContext);
pageContext.setPolicyReferenceResolver(
PolicyReferenceResolverTestHelper.getCommonExpectations(
expectations, mockFactory));
// need to set up parent element with properties otherwise there will
// be a NPE in #setNormalAndOverImages
MenuElementImpl menuElement = new MenuElementImpl();
Styles testStyles = StylesBuilder.getStyles(
"mcs-menu-image-style: rollover");
PrivateAccessor.setField(menuElement, "menuProperties",
testStyles.getPropertyValues());
pageContext.pushElement(menuElement);
MenuModelBuilder menuModelBuilder = pageContext.getMenuBuilder();
//builder#startMenuItem will fail unless this has been called
menuModelBuilder.startMenu();
MenuItemAttributes menuItemAttrs = createAttributes();
int result = element.elementStart(requestContext, menuItemAttrs);