org.fest.swing.driver
Class JPopupMenuDriver

java.lang.Object
  extended by org.fest.swing.driver.ComponentDriver
      extended by org.fest.swing.driver.ContainerDriver
          extended by org.fest.swing.driver.JComponentDriver
              extended by org.fest.swing.driver.JPopupMenuDriver

public class JPopupMenuDriver
extends JComponentDriver

Understands functional testing of JPopupMenus:

This class is intended for internal use only. Please use the classes in the package org.fest.swing.fixture in your tests.

Author:
Yvonne Wang, Alex Ruiz

Field Summary
 
Fields inherited from class org.fest.swing.driver.ComponentDriver
robot
 
Constructor Summary
JPopupMenuDriver(Robot robot)
          Creates a new JPopupMenuDriver.
 
Method Summary
 JMenuItem menuItem(JPopupMenu popupMenu, GenericTypeMatcher<? extends JMenuItem> matcher)
          Finds a JMenuItem, contained in the Container, that matches the specified search criteria.
 JMenuItem menuItem(JPopupMenu popupMenu, String name)
          Finds a JMenuItem, contained in the Container, which name matches the specified one.
 String[] menuLabelsOf(JPopupMenu popupMenu)
          Returns the contents of the pop-up menu as a String array.
 
Methods inherited from class org.fest.swing.driver.JComponentDriver
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible
 
Methods inherited from class org.fest.swing.driver.ContainerDriver
move, resize, resizeHeight, resizeWidth
 
Methods inherited from class org.fest.swing.driver.ComponentDriver
assertIsEnabledAndShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, focus, focusAndWaitForFocusGain, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPopupMenuDriver

public JPopupMenuDriver(Robot robot)
Creates a new JPopupMenuDriver.

Parameters:
robot - the robot to use to simulate user input.
Method Detail

menuLabelsOf

@RunsInEDT
public String[] menuLabelsOf(JPopupMenu popupMenu)
Returns the contents of the pop-up menu as a String array.

Parameters:
popupMenu - the target JPopupMenu.
Returns:
the contents of the pop-up menu as a String array.

menuItem

@RunsInEDT
public JMenuItem menuItem(JPopupMenu popupMenu,
                                    String name)
Finds a JMenuItem, contained in the Container, which name matches the specified one.

Parameters:
popupMenu - the target JPopupMenu.
name - the name to match.
Returns:
the JMenuItem found.
Throws:
ComponentLookupException - if a JMenuItem having a matching name could not be found.
ComponentLookupException - if more than one JMenuItem having a matching name is found.

menuItem

public JMenuItem menuItem(JPopupMenu popupMenu,
                          GenericTypeMatcher<? extends JMenuItem> matcher)
Finds a JMenuItem, contained in the Container, that matches the specified search criteria.

Parameters:
popupMenu - the target JPopupMenu.
matcher - contains the search criteria for finding a JMenuItem.
Returns:
the JMenuItem found.
Throws:
ComponentLookupException - if a JMenuItem that matches the given search criteria could not be found.
ComponentLookupException - if more than one JMenuItem that matches the given search criteria is found.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.