Search in sources :

Example 1 with TestOperationContext

use of org.opennms.features.topology.app.internal.TestOperationContext in project opennms by OpenNMS.

the class MenuBuilderTest method createContextMenuTest.

@Test
public void createContextMenuTest() {
    MenuBuilder builder = new MenuBuilder();
    builder.addMenuItem(createEmptyMenuItem("Test"), "Layout");
    MenuBar menubar = builder.build(Lists.newArrayList(), new TestOperationContext(null));
    TopologyContextMenu contextMenu = new TopologyContextMenu(menubar);
    List<ContextMenuState.ContextMenuItemState> contextMenuItems = contextMenu.getItems();
    assertEquals(1, contextMenuItems.size());
    assertEquals("Layout", contextMenuItems.get(0).caption);
    List<ContextMenuState.ContextMenuItemState> subMenuItems = contextMenuItems.get(0).getChildren();
    assertEquals(1, subMenuItems.size());
    ContextMenuState.ContextMenuItemState submenuItem = subMenuItems.get(0);
    assertEquals("Test", submenuItem.caption);
}
Also used : TestOperationContext(org.opennms.features.topology.app.internal.TestOperationContext) ContextMenuState(org.vaadin.peter.contextmenu.client.ContextMenuState) MenuBar(com.vaadin.ui.MenuBar) Test(org.junit.Test)

Aggregations

MenuBar (com.vaadin.ui.MenuBar)1 Test (org.junit.Test)1 TestOperationContext (org.opennms.features.topology.app.internal.TestOperationContext)1 ContextMenuState (org.vaadin.peter.contextmenu.client.ContextMenuState)1