public class JOptionPaneFinder extends ComponentFinderTemplate<JOptionPane>
JOptionPanes. Lookups are performed till a file chooser is found, or
until the given time to perform the lookup is over. The default lookup time is 5 seconds.
This example illustrates finding a by name, using the default lookup time (5
seconds):
JOptionPane
JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane().using(robot);
Where robot is an instance of .
Robot
This example shows how to find a by type using a lookup time of 10 seconds:
JOptionPane
JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane().withTimeout(10000).using(robot);We can also specify the time unit:
JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane().withTimeout(10, SECONDS).using(robot);
This example shows how to find a using a JOptionPane:
GenericTypeMatcher
GenericTypeMatcher<JOptionPane> matcher = new GenericTypeMatcher<JOptionPane>() {
protected boolean isMatching(JOptionPane optionPane) {
return "A message".equals(optionPane.getMessage());
}
};
JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane(matcher).using(robot);
| Modifier | Constructor and Description |
|---|---|
protected |
JOptionPaneFinder()
Creates a new
JOptionPaneFinder. |
protected |
JOptionPaneFinder(GenericTypeMatcher<? extends JOptionPane> matcher)
Creates a new
JOptionPaneFinder. |
| Modifier and Type | Method and Description |
|---|---|
protected JOptionPane |
cast(Component c)
Casts the given
Component to . |
static JOptionPaneFinder |
findOptionPane()
Creates a new
capable of looking up a . |
static JOptionPaneFinder |
findOptionPane(GenericTypeMatcher<? extends JOptionPane> matcher)
Creates a new
capable of looking up a
using the given matcher. |
JOptionPaneFixture |
using(Robot robot)
Finds a
by name or type. |
JOptionPaneFinder |
withTimeout(long timeout)
Sets the timeout for this finder.
|
JOptionPaneFinder |
withTimeout(long timeout,
TimeUnit unit)
Sets the timeout for this finder.
|
findComponentWithprotected JOptionPaneFinder()
JOptionPaneFinder. This finder looks up a JOptionPane by
type.protected JOptionPaneFinder(GenericTypeMatcher<? extends JOptionPane> matcher)
JOptionPaneFinder.matcher - specifies the search criteria to use when looking up a JOptionPane.public static JOptionPaneFinder findOptionPane()
JOptionPaneFinder capable of looking up a JOptionPane.public static JOptionPaneFinder findOptionPane(GenericTypeMatcher<? extends JOptionPane> matcher)
JOptionPaneFinder capable of looking up a JOptionPane
using the given matcher.matcher - the given matcher.public JOptionPaneFixture using(Robot robot)
JOptionPane by name or type.using in class ComponentFinderTemplate<JOptionPane>robot - contains the underlying finding to delegate the search to.JOptionPaneFixture managing the found JOptionPane.WaitTimedOutError - if a JOptionPane could not be found.public JOptionPaneFinder withTimeout(long timeout)
withTimeout in class ComponentFinderTemplate<JOptionPane>timeout - the number of milliseconds before stopping the search.public JOptionPaneFinder withTimeout(long timeout, TimeUnit unit)
withTimeout in class ComponentFinderTemplate<JOptionPane>timeout - the period of time the search should be performed.unit - the time unit for timeout.protected JOptionPane cast(Component c)
Component to JOptionPane.cast in class ComponentFinderTemplate<JOptionPane>c - the given Component.Component, casted to JFileChooser.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.