public class JComboBoxDriver extends JComponentDriver
JComboBoxes:
org.fest.swing.fixture in your tests.robot| Constructor and Description |
|---|
JComboBoxDriver(Robot robot)
Creates a new
JComboBoxDriver. |
| Modifier and Type | Method and Description |
|---|---|
void |
cellReader(JComboBoxCellReader newCellReader)
Updates the implementation of
to use when comparing internal values
of a and the values expected in a test. |
void |
clearSelection(JComboBox comboBox)
Clears the selection in the given
. |
String[] |
contentsOf(JComboBox comboBox)
Returns an array of
Strings that represents the contents of the given
list. |
JList |
dropDownList()
|
void |
enterText(JComboBox comboBox,
String text)
Simulates a user entering the specified text in the
. |
void |
pressAndReleaseKeys(JComboBox comboBox,
int... keyCodes)
Simulates a user pressing and releasing the given keys on the
. |
void |
replaceText(JComboBox comboBox,
String text)
Simulates a user entering the specified text in the
, replacing any text. |
void |
requireEditable(JComboBox comboBox)
Asserts that the given
is editable. |
void |
requireItemCount(JComboBox comboBox,
int expected)
Verifies that number of items in the given
is equal to the expected one. |
void |
requireNoSelection(JComboBox comboBox)
Verifies that the
does not have any selection. |
void |
requireNotEditable(JComboBox comboBox)
Asserts that the given
is not editable. |
void |
requireSelection(JComboBox comboBox,
int index)
Verifies that the index of the selected item in the
is equal to the given value. |
void |
requireSelection(JComboBox comboBox,
Pattern pattern)
Verifies that the
String representation of the selected item in the
matches the given regular expression pattern. |
void |
requireSelection(JComboBox comboBox,
String value)
Verifies that the
String representation of the selected item in the
matches the given text. |
void |
selectAllText(JComboBox comboBox)
Simulates a user selecting the text in the
. |
void |
selectItem(JComboBox comboBox,
int index)
Selects the item under the given index in the
. |
void |
selectItem(JComboBox comboBox,
Pattern pattern)
Selects the first item matching the given regular expression pattern in the
. |
void |
selectItem(JComboBox comboBox,
String value)
Selects the first item matching the given text in the
. |
String |
value(JComboBox comboBox,
int index)
Returns the
String representation of the element under the given index, using this driver's
. |
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisiblemove, resize, resizeHeight, resizeWidthassertIsEnabledAndShowing, 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, waitForShowingpublic JComboBoxDriver(Robot robot)
JComboBoxDriver.robot - the robot to use to simulate user input.@RunsInEDT public String[] contentsOf(JComboBox comboBox)
Strings that represents the contents of the given JComboBox
list. The String representation of each element is performed using this driver's
JComboBoxCellReader.comboBox - the target JComboBox.Strings that represent the contents of the given JComboBox list.value(JComboBox, int),
cellReader(JComboBoxCellReader)@RunsInEDT public void selectItem(JComboBox comboBox, String value)
JComboBox. The text of the
JComboBox items is obtained by this fixture's JComboBoxCellReader.comboBox - the target JComboBox.value - the value to match. It can be a regular expression.LocationUnavailableException - if an element matching the given value cannot be found.IllegalStateException - if the JComboBox is disabled.IllegalStateException - if the JComboBox is not showing on the screen.cellReader(JComboBoxCellReader)@RunsInEDT public void selectItem(JComboBox comboBox, Pattern pattern)
JComboBox. The
text of the JComboBox items is obtained by this fixture's JComboBoxCellReader.comboBox - the target JComboBox.pattern - the regular expression pattern to match.LocationUnavailableException - if an element matching the given pattern cannot be found.IllegalStateException - if the JComboBox is disabled.IllegalStateException - if the JComboBox is not showing on the screen.NullPointerException - if the given regular expression pattern is null.cellReader(JComboBoxCellReader)@RunsInEDT public void requireSelection(JComboBox comboBox, String value)
String representation of the selected item in the JComboBox
matches the given text.comboBox - the target JComboBox.value - the text to match. It can be a regular expression.AssertionError - if the selected item does not match the given value.cellReader(JComboBoxCellReader)@RunsInEDT public void requireSelection(JComboBox comboBox, Pattern pattern)
String representation of the selected item in the JComboBox
matches the given regular expression pattern.comboBox - the target JComboBox.pattern - the regular expression pattern to match.AssertionError - if the selected item does not match the given regular expression pattern.NullPointerException - if the given regular expression pattern is null.cellReader(JComboBoxCellReader)@RunsInEDT public void requireSelection(JComboBox comboBox, int index)
JComboBox is equal to the given value.comboBox - the target JComboBox.index - the expected selection index.AssertionError - if the selection index is not equal to the given value.@RunsInEDT public void requireNoSelection(JComboBox comboBox)
JComboBox does not have any selection.comboBox - the target JComboBox.AssertionError - if the JComboBox has a selection.public String value(JComboBox comboBox, int index)
String representation of the element under the given index, using this driver's
JComboBoxCellReader.comboBox - the target JComboBox.index - the given index.IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JComboBox.cellReader(JComboBoxCellReader)public void clearSelection(JComboBox comboBox)
JComboBox. Since this method does not simulate user input,
it does not verifies that the JComboBox is enabled and showing.comboBox - the target JComboBox.@RunsInEDT public void selectItem(JComboBox comboBox, int index)
JComboBox.comboBox - the target JComboBox.index - the given index.IllegalStateException - if the JComboBox is disabled.IllegalStateException - if the JComboBox is not showing on the screen.IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JComboBox.@RunsInEDT public void replaceText(JComboBox comboBox, String text)
JComboBox, replacing any text. This action
is executed only if the JComboBox is editable.comboBox - the target JComboBox.text - the text to enter.IllegalStateException - if the JComboBox is disabled.IllegalStateException - if the JComboBox is not showing on the screen.IllegalStateException - if the JComboBox is not editable.@RunsInEDT public void selectAllText(JComboBox comboBox)
JComboBox. This action is executed only if the
JComboBox is editable.comboBox - the target JComboBox.IllegalStateException - if the JComboBox is disabled.IllegalStateException - if the JComboBox is not showing on the screen.IllegalStateException - if the JComboBox is not editable.@RunsInEDT public void enterText(JComboBox comboBox, String text)
JComboBox. This action is executed only
if the JComboBox is editable.comboBox - the target JComboBox.text - the text to enter.IllegalStateException - if the JComboBox is disabled.IllegalStateException - if the JComboBox is not showing on the screen.IllegalStateException - if the JComboBox is not editable.ActionFailedException - if the JComboBox does not have an editor.@RunsInEDT public void pressAndReleaseKeys(JComboBox comboBox, int... keyCodes)
JComboBox.comboBox - the target JComboBox.keyCodes - one or more codes of the keys to press.NullPointerException - if the given array of codes is null.IllegalStateException - if the JComboBox is disabled.IllegalStateException - if the JComboBox is not showing on the screen.IllegalArgumentException - if the given code is not a valid key code.KeyEvent@RunsInEDT public JList dropDownList()
JList.ComponentLookupException - if the JList in the pop-up could not be found.@RunsInEDT public void requireEditable(JComboBox comboBox)
JComboBox is editable.comboBox - the target JComboBox.AssertionError - if the JComboBox is not editable.@RunsInEDT public void requireNotEditable(JComboBox comboBox)
JComboBox is not editable.comboBox - the given JComboBox.AssertionError - if the JComboBox is editable.public void cellReader(JComboBoxCellReader newCellReader)
JComboBoxCellReader to use when comparing internal values
of a JComboBox and the values expected in a test.newCellReader - the new JComboBoxCellValueReader to use.NullPointerException - if newCellReader is null.@RunsInEDT public void requireItemCount(JComboBox comboBox, int expected)
JComboBox is equal to the expected one.comboBox - the target JComboBox.expected - the expected number of items.AssertionError - if the number of items in the given JComboBox is not equal to the
expected one.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.