@InternalApi public class JOptionPaneDriver extends JComponentDriver
Supports functional testing of JOptionPanes.
Note: This class is intended for internal use only. Please use the classes in the package
org.assertj.swing.fixture in your tests.
robot| Constructor and Description |
|---|
JOptionPaneDriver(Robot robot)
Creates a new
JOptionPaneDriver. |
| Modifier and Type | Method and Description |
|---|---|
JButton |
buttonWithText(JOptionPane optionPane,
Pattern pattern)
Finds a button in the
JOptionPane whose text matches the given regular expression pattern. |
JButton |
buttonWithText(JOptionPane optionPane,
String text)
Finds a button in the
JOptionPane containing the given text. |
JButton |
cancelButton(JOptionPane optionPane)
Finds the "Cancel" button in the
JOptionPane. |
JButton |
noButton(JOptionPane optionPane)
Finds the "No" button in the
JOptionPane. |
JButton |
okButton(JOptionPane optionPane)
Finds the "OK" button in the
JOptionPane. |
void |
requireErrorMessage(JOptionPane optionPane)
Asserts that the
JOptionPane is displaying an error message. |
void |
requireInformationMessage(JOptionPane optionPane)
Asserts that the
JOptionPane is displaying an information message. |
void |
requireMessage(JOptionPane optionPane,
Object message)
Asserts that the title of the
JOptionPane matches the given value. |
void |
requireMessage(JOptionPane optionPane,
Pattern pattern)
Asserts that the title of the
JOptionPane matches the given regular expression pattern. |
void |
requireOptions(JOptionPane optionPane,
Object[] options)
Asserts that the
JOptionPane has the given options. |
void |
requirePlainMessage(JOptionPane optionPane)
Asserts that the
JOptionPane is displaying a plain message. |
void |
requireQuestionMessage(JOptionPane optionPane)
Asserts that the
JOptionPane is displaying a question. |
void |
requireTitle(JOptionPane optionPane,
Pattern pattern)
Asserts that the title in the given
JOptionPane matches the given regular expression pattern. |
void |
requireTitle(JOptionPane optionPane,
String title)
Asserts that the title in the given
JOptionPane matches the given value. |
void |
requireWarningMessage(JOptionPane optionPane)
Asserts that the
JOptionPane is displaying a warning message. |
String |
title(JOptionPane optionPane)
Returns the title of the given
JOptionPane. |
JButton |
yesButton(JOptionPane optionPane)
Finds the "Yes" button in the
JOptionPane. |
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisibledoResizeHeight, doResizeWidth, isResizable, move, resizebackgroundOf, checkInEdtEnabledAndShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, focus, focusAndWaitForFocusGain, fontOf, foregroundOf, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowingpublic JOptionPaneDriver(@Nonnull Robot robot)
JOptionPaneDriver.robot - the robot to use to simulate user input.@RunsInEDT public void requireTitle(@Nonnull JOptionPane optionPane, @Nullable String title)
JOptionPane matches the given value.optionPane - the target JOptionPane.title - the title to match. It can be a regular expression.AssertionError - if the JOptionPane does not have the given title.@RunsInEDT public void requireTitle(@Nonnull JOptionPane optionPane, @Nonnull Pattern pattern)
JOptionPane matches the given regular expression pattern.optionPane - the target JOptionPane.pattern - the regular expression pattern to match.NullPointerException - if the given regular expression pattern is null.AssertionError - if the JOptionPane does not have the given title.@RunsInEDT @Nullable public String title(@Nonnull JOptionPane optionPane)
JOptionPane.optionPane - the target JOptionPane.JOptionPane.@RunsInEDT public void requireMessage(@Nonnull JOptionPane optionPane, @Nullable Object message)
JOptionPane matches the given value. If the given value is a regular
expression and the message in the JOptionPane is not a String, this method will use the
toString representation of such message. message in the JOptionPane is not a String, this
method will use the toString representation of such message.optionPane - the target JOptionPane.message - the message to verify. If it is a String, it can be specified as a regular expression.AssertionError - if the message in the JOptionPane is not equal to or does not match the given
message.@RunsInEDT public void requireMessage(@Nonnull JOptionPane optionPane, @Nonnull Pattern pattern)
JOptionPane matches the given regular expression pattern. If the message in
the JOptionPane is not a String, this method will use the toString representation of such
message.optionPane - the target JOptionPane.pattern - the regular expression to match.NullPointerException - if the given regular expression pattern is null.AssertionError - if the message in the JOptionPaneFixture does not match the given regular expression
pattern.@RunsInEDT public void requireOptions(@Nonnull JOptionPane optionPane, @Nonnull Object[] options)
JOptionPane has the given options.optionPane - the target JOptionPane.options - the options to verify.AssertionError - if the JOptionPane does not have the given options.@RunsInEDT @Nonnull public JButton okButton(@Nonnull JOptionPane optionPane)
JOptionPane. This method is independent of locale and platform.optionPane - the target JOptionPane.ComponentLookupException - if the a "OK" button cannot be found.@RunsInEDT @Nonnull public JButton cancelButton(@Nonnull JOptionPane optionPane)
JOptionPane. This method is independent of locale and platform.optionPane - the target JOptionPane.ComponentLookupException - if the a "Cancel" button cannot be found.@RunsInEDT @Nonnull public JButton yesButton(@Nonnull JOptionPane optionPane)
JOptionPane. This method is independent of locale and platform.optionPane - the target JOptionPane.ComponentLookupException - if the a "Yes" button cannot be found.@RunsInEDT @Nonnull public JButton noButton(@Nonnull JOptionPane optionPane)
JOptionPane. This method is independent of locale and platform.optionPane - the target JOptionPane.ComponentLookupException - if the a "No" button cannot be found.@RunsInEDT @Nonnull public JButton buttonWithText(@Nonnull JOptionPane optionPane, @Nullable String text)
JOptionPane containing the given text.optionPane - the target JOptionPane.text - the text of the button to find and return. It can be a regular expression.ComponentLookupException - if the a button with the given text cannot be found.@RunsInEDT @Nonnull public JButton buttonWithText(@Nonnull JOptionPane optionPane, @Nonnull Pattern pattern)
JOptionPane whose text matches the given regular expression pattern.optionPane - the target JOptionPane.pattern - the regular expression pattern to match.NullPointerException - if the given regular expression pattern is null.ComponentLookupException - if the a button with the given text cannot be found.@RunsInEDT public void requireErrorMessage(@Nonnull JOptionPane optionPane)
JOptionPane is displaying an error message.optionPane - the target JOptionPane.@RunsInEDT public void requireInformationMessage(@Nonnull JOptionPane optionPane)
JOptionPane is displaying an information message.optionPane - the target JOptionPane.@RunsInEDT public void requireWarningMessage(@Nonnull JOptionPane optionPane)
JOptionPane is displaying a warning message.optionPane - the target JOptionPane.@RunsInEDT public void requireQuestionMessage(@Nonnull JOptionPane optionPane)
JOptionPane is displaying a question.optionPane - the target JOptionPane.@RunsInEDT public void requirePlainMessage(@Nonnull JOptionPane optionPane)
JOptionPane is displaying a plain message.optionPane - the target JOptionPane.Copyright © 2014 AssertJ. All rights reserved.