public class JListFixture extends ComponentFixture<JList> implements CommonComponentFixture, ItemGroupFixture, JComponentFixture, JPopupMenuInvokerFixture
JLists:
The conversion between the values given in tests and the values being displayed by a
renderer is performed by a JList. This fixture uses a
JListCellReader by default.
BasicJListCellReader
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target| Constructor and Description |
|---|
JListFixture(Robot robot,
JList target)
Creates a new
. |
JListFixture(Robot robot,
String listName)
Creates a new
. |
| Modifier and Type | Method and Description |
|---|---|
JListFixture |
cellReader(JListCellReader cellReader)
Updates the implementation of
to use when comparing internal values of
this fixture's and the values expected in a test. |
JListFixture |
clearSelection()
Clears the selection in this fixture's
. |
JListFixture |
click()
Simulates a user clicking this fixture's
. |
JListFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JListFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's
. |
JListFixture |
clickItem(int index)
Simulates a user clicking an item in this fixture's
. |
JListFixture |
clickItem(Pattern pattern)
Simulates a user clicking an item in this fixture's
. |
JListFixture |
clickItem(String text)
Simulates a user clicking an item in this fixture's
. |
Object |
clientProperty(Object key)
Returns the client property stored in this fixture's
, under the given key. |
String[] |
contents()
Returns the
String representation of the elements in this fixture's ,
using this fixture's . |
JListFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
JListFixture |
doubleClickItem(int index)
Deprecated.
to be removed in version 2.0. Use
and
instead. |
JListFixture |
doubleClickItem(String text)
Deprecated.
to be removed in version 2.0. Use
and
instead. |
JListFixture |
drag(int index)
Simulates a user dragging an item from this fixture's
. |
JListFixture |
drag(Pattern pattern)
Simulates a drag operation at the location of the first item in this fixture's
matching
the given regular expression pattern. |
JListFixture |
drag(String text)
Simulates a drag operation at the location of the first item in this fixture's
matching
the given value. |
protected void |
driver(JListDriver newDriver)
Sets the
to be used by this fixture. |
JListFixture |
drop()
Simulates a user dropping an item at the center of this fixture's
. |
JListFixture |
drop(int index)
Simulates a user dropping an item to this fixture's
. |
JListFixture |
drop(Pattern pattern)
Ends a drag operation at the location of the first item matching the given regular expression pattern.
|
JListFixture |
drop(String text)
Ends a drag operation at the location of the first item matching the given value.
|
JListFixture |
focus()
Gives input focus to this fixture's
. |
JListItemFixture |
item(int index)
Returns a fixture that manages the list item specified by the given index.
|
JListItemFixture |
item(Pattern pattern)
Returns a fixture that manages the list item whose text matches the given regular expression pattern.
|
JListItemFixture |
item(String text)
Returns a fixture that manages the list item specified by the given text.
|
JListFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JListFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's
. |
JListFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JListFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JListFixture |
requireDisabled()
Asserts that this fixture's
is not enabled. |
JListFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JListFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JListFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JListFixture |
requireItemCount(int expected)
Verifies that this fixture's
has the expected number of items |
JListFixture |
requireNoSelection()
Verifies that this fixture's
does not have any selection. |
JListFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JListFixture |
requireSelectedItems(int... indices)
Verifies that the given item indices are selected in this fixture's
. |
JListFixture |
requireSelectedItems(Pattern[] patterns)
Verifies that the
String representations of the selected items in this fixture's
match the given regular expression patterns. |
JListFixture |
requireSelectedItems(String... items)
Verifies that the
String representations of the selected items in this fixture's
match the given text items. |
JListFixture |
requireSelection(int index)
Verifies that the index of the selected item in this fixture's
is equal to the given
value. |
JListFixture |
requireSelection(Pattern pattern)
Verifies that the
String representation of the selected item in this fixture's
matches the given regular expression pattern. |
JListFixture |
requireSelection(String text)
Verifies that the
String representation of the selected item in this fixture's
matches the given text. |
JListFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's
matches the given regular expression
pattern. |
JListFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's
matches the given value. |
JListFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JListFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
String[] |
selection()
Returns the
String representation of the selected elements in this fixture's
, using this fixture's . |
JListFixture |
selectItem(int index)
Simulates a user selecting an item in this fixture's
. |
JListFixture |
selectItem(Pattern pattern)
Simulates a user selecting an item in this fixture's
. |
JListFixture |
selectItem(String text)
Simulates a user selecting an item in this fixture's
. |
JListFixture |
selectItems(int... indices)
Simulates a user selecting the specified items in this fixture's
. |
JListFixture |
selectItems(Pattern... patterns)
Simulates a user selecting the specified items in this fixture's
. |
JListFixture |
selectItems(Range.From from,
Range.To to)
Simulates a user selecting the items (in the specified range) in this fixture's
. |
JListFixture |
selectItems(String... items)
Simulates a user selecting the specified items in this fixture's
. |
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu. |
JPopupMenuFixture |
showPopupMenuAt(int index)
Shows a pop-up menu at the location of the specified item in this fixture's
. |
JPopupMenuFixture |
showPopupMenuAt(Pattern pattern)
Shows a pop-up menu at the location of the first item matching the given regular expression pattern in this
fixture's
. |
JPopupMenuFixture |
showPopupMenuAt(Point p)
Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up
menu. |
JPopupMenuFixture |
showPopupMenuAt(String text)
Shows a pop-up menu at the location of the first item matching the given value in this fixture's
. |
String |
valueAt(int index)
Returns the
String representation of the value of an item in this fixture's
, using this fixture's . |
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNullpublic JListFixture(Robot robot, String listName)
JListFixture.robot - performs simulation of user events on a JList.listName - the name of the JList to find using the given Robot.NullPointerException - if robot is null.ComponentLookupException - if a matching JList could not be found.ComponentLookupException - if more than one matching JList is found.public JListFixture(Robot robot, JList target)
JListFixture.robot - performs simulation of user events on the given JList.target - the JList to be managed by this fixture.NullPointerException - if robot is null.NullPointerException - if target is null.protected final void driver(JListDriver newDriver)
JListDriver to be used by this fixture.newDriver - the new JListDriver.NullPointerException - if the given driver is null.public String valueAt(int index)
String representation of the value of an item in this fixture's
JList, using this fixture's JListCellReader.valueAt in interface ItemGroupFixtureindex - the index of the item to return.String representation of the value of an item in this fixture's JList.IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in
the JList.cellReader(JListCellReader)public String[] contents()
String representation of the elements in this fixture's JList,
using this fixture's JListCellReader.contents in interface ItemGroupFixtureString representation of the elements in this fixture's JList.cellReader(JListCellReader)public String[] selection()
String representation of the selected elements in this fixture's
JList, using this fixture's JListCellReader.String representation of the selected elements in this fixture's JList.cellReader(JListCellReader)public JListItemFixture item(int index)
index - of the item.IndexOutOfBoundsException - if the index is out of bounds.public JListItemFixture item(String text)
text - the text of the item. It can be a regular expression.LocationUnavailableException - if an element matching the given text cannot be found.public JListItemFixture item(Pattern pattern)
pattern - the regular expression pattern to match.LocationUnavailableException - if an element matching the given text cannot be found.NullPointerException - if the given regular expression pattern is null.public JListFixture clearSelection()
JList. Since this method does not simulate user input,
it does not verifies that this fixture's JList is enabled and showing.clearSelection in interface ItemGroupFixturepublic JListFixture selectItems(Range.From from, Range.To to)
JList.from - the starting point of the selection.to - the last item to select (inclusive.)IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.IndexOutOfBoundsException - if the any index is negative or greater than the index of the last item in the
JList.public JListFixture selectItems(int... indices)
JList.indices - the indices of the items to select.NullPointerException - if the given array is null.IllegalArgumentException - if the given array is empty.IndexOutOfBoundsException - if any of the indices is negative or greater than the index of the last item in
the JList.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.public JListFixture selectItems(String... items)
JList. The items to select
should match the given values.items - the text of the items to select. Each String can be a regular expression.NullPointerException - if the given array is null.IllegalArgumentException - if the given array is empty.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.LocationUnavailableException - if an element matching the any of the given values cannot be found.cellReader(JListCellReader)public JListFixture selectItems(Pattern... patterns)
JList. The items to select
should select the given regular expression patterns.patterns - the regular expression patterns to match.NullPointerException - if the given array is null.NullPointerException - if any of the regular expression patterns is null.IllegalArgumentException - if the given array is empty.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.LocationUnavailableException - if an element matching the any of the given regular expression patterns cannot
be found.cellReader(JListCellReader)public JListFixture selectItem(int index)
JList.selectItem in interface ItemGroupFixtureindex - the index of the item to select.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.item(int),
JListItemFixture.select()public JListFixture selectItem(String text)
JList.selectItem in interface ItemGroupFixturetext - the text of the item to select. It can be a regular expression.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.LocationUnavailableException - if an element matching the given text cannot be found.item(String),
JListItemFixture.select(),
cellReader(JListCellReader)public JListFixture selectItem(Pattern pattern)
JList. The value of the item to select
must match the given regular expression pattern.selectItem in interface ItemGroupFixturepattern - the regular expression pattern to match.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.LocationUnavailableException - if an element matching the given text cannot be found.NullPointerException - if the given regular expression pattern is null.item(Pattern),
JListItemFixture.select(),
cellReader(JListCellReader)public JListFixture clickItem(int index)
JList.index - the index of the item to clicking.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.item(int),
JListItemFixture.click()public JListFixture clickItem(String text)
JList.text - the text of the item to select. It can be a regular expression.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.LocationUnavailableException - if an element matching the given text cannot be found.item(String),
JListItemFixture.select(),
cellReader(JListCellReader)public JListFixture clickItem(Pattern pattern)
JList. The value of the item to select
must match the given regular expression pattern.pattern - the regular expression pattern to match.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.LocationUnavailableException - if an element matching the given text cannot be found.NullPointerException - if the given regular expression pattern is null.item(Pattern),
JListItemFixture.select(),
cellReader(JListCellReader)@Deprecated public JListFixture doubleClickItem(int index)
JList.index - the index of the item to double-click.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in
the JList.@Deprecated public JListFixture doubleClickItem(String text)
item(String) and
JListItemFixture.doubleClick() instead.JList.text - the text of the item to double-click.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.LocationUnavailableException - if an element matching the given String cannot be found.public JListFixture click()
JList.click in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.public JListFixture click(MouseButton button)
JList.click in interface MouseInputSimulationFixturebutton - the button to click.NullPointerException - if the given MouseButton is null.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.public JListFixture click(MouseClickInfo mouseClickInfo)
JList.click in interface MouseInputSimulationFixturemouseClickInfo - specifies the button to click and the times the button should be clicked.NullPointerException - if the given MouseClickInfo is null.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.public JListFixture doubleClick()
JList.doubleClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.public JListFixture rightClick()
JList.rightClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.public JListFixture focus()
JList.focus in interface FocusableComponentFixtureIllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.public JListFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JList.
Modifiers is a mask from the available InputEvent masks.pressAndReleaseKey in interface KeyboardInputSimulationFixturekeyPressInfo - specifies the key and modifiers to press.NullPointerException - if the given KeyPressInfo is null.IllegalArgumentException - if the given code is not a valid key code.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.KeyPressInfopublic JListFixture pressAndReleaseKeys(int... keyCodes)
JList.pressAndReleaseKeys in interface KeyboardInputSimulationFixturekeyCodes - one or more codes of the keys to press.NullPointerException - if the given array of codes is null.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.KeyEventpublic JListFixture pressKey(int keyCode)
JList.pressKey in interface KeyboardInputSimulationFixturekeyCode - the code of the key to press.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.KeyEventpublic JListFixture releaseKey(int keyCode)
JList.releaseKey in interface KeyboardInputSimulationFixturekeyCode - the code of the key to release.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.KeyEventpublic JListFixture drag(String text)
JList matching
the given value.text - the text of the item to drag. It can be a regular expression.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.LocationUnavailableException - if an element matching the given text cannot be found.cellReader(JListCellReader)public JListFixture drop(String text)
text - the text of the item to drop. It can be a regular expression.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.LocationUnavailableException - if an element matching the given text cannot be found.ActionFailedException - if there is no drag action in effect.public JListFixture drag(Pattern pattern)
JList matching
the given regular expression pattern.pattern - the regular expression pattern to match.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.NullPointerException - if the given regular expression pattern in null.LocationUnavailableException - if an element matching the given regular expression pattern cannot be found.cellReader(JListCellReader)public JListFixture drop(Pattern pattern)
pattern - the regular expression pattern to match.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.NullPointerException - if the given regular expression pattern in null.LocationUnavailableException - if an element matching the given text cannot be found.ActionFailedException - if there is no drag action in effect.cellReader(JListCellReader)public JListFixture drop()
JList.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.ActionFailedException - if there is no drag action in effect.public JListFixture drag(int index)
JList.index - the index of the item to drag.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.public JListFixture drop(int index)
JList.index - the index of the item to drop.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.ActionFailedException - if there is no drag action in effect.public JPopupMenuFixture showPopupMenuAt(int index)
JList.index - the index of the item.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.public JPopupMenuFixture showPopupMenuAt(String text)
JList.text - the text of the item. It can be a regular expression.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.LocationUnavailableException - if an element matching the given value cannot be found.public JPopupMenuFixture showPopupMenuAt(Pattern pattern)
JList.pattern - the regular expression pattern to match.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.NullPointerException - if the given regular expression pattern is null.ComponentLookupException - if a pop-up menu cannot be found.LocationUnavailableException - if an element matching the given value cannot be found.public JListFixture requireFocused()
JList has input focus.requireFocused in interface FocusableComponentFixtureAssertionError - if this fixture's JList does not have input focus.public JListFixture requireEnabled()
JList is enabled.requireEnabled in interface StateVerificationFixtureAssertionError - if this fixture's JList is disabled.public JListFixture requireEnabled(Timeout timeout)
JList is enabled.requireEnabled in interface StateVerificationFixturetimeout - the time this fixture will wait for the component to be enabled.WaitTimedOutError - if this fixture's JList is never enabled.public JListFixture requireDisabled()
JList is not enabled.requireDisabled in interface StateVerificationFixtureAssertionError - if this fixture's JList is enabled.public JListFixture requireVisible()
JList is visible.requireVisible in interface StateVerificationFixtureAssertionError - if this fixture's JList is not visible.public JListFixture requireNotVisible()
JList is not visible.requireNotVisible in interface StateVerificationFixtureAssertionError - if this fixture's JList is visible.public JListFixture requireSelection(String text)
String representation of the selected item in this fixture's
JList matches the given text.requireSelection in interface ItemGroupFixturetext - the text to match. It can be a regular expression pattern.AssertionError - if the selected item does not match the given text.cellReader(JListCellReader)public JListFixture requireSelection(Pattern pattern)
String representation of the selected item in this fixture's
JList matches the given regular expression pattern.requireSelection in interface ItemGroupFixturepattern - 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(JListCellReader)public JListFixture requireSelection(int index)
JList is equal to the given
value.requireSelection in interface ItemGroupFixtureindex - the expected selection index.AssertionError - if the selected index is not equal to the given one.public JListFixture requireSelectedItems(String... items)
String representations of the selected items in this fixture's
JList match the given text items.items - text items to match. Each String can be a regular expression.NullPointerException - if the given array is null.IllegalArgumentException - if the given array is empty.AssertionError - if the selected items do not match the given text items.cellReader(JListCellReader)public JListFixture requireSelectedItems(Pattern[] patterns)
String representations of the selected items in this fixture's
JList match the given regular expression patterns.patterns - the regular expression patterns to match.NullPointerException - if the given array is null.IllegalArgumentException - if the given array is empty.NullPointerException - if any of the patterns in the given array is null.AssertionError - if the selected items do not match the given regular expression patterns.cellReader(JListCellReader)public JListFixture requireSelectedItems(int... indices)
JList.indices - the expected indices of the selected items.NullPointerException - if the given array is null.IllegalArgumentException - if the given array is empty.AssertionError - if the selection in this fixture's JList does not match the given one.public JListFixture requireNoSelection()
JList does not have any selection.requireNoSelection in interface ItemGroupFixtureAssertionError - if this fixture's JList has a selection.public JListFixture requireItemCount(int expected)
JList has the expected number of itemsrequireItemCount in interface ItemGroupFixtureexpected - the expected number of items.AssertionError - if the number of items in this fixture's JList is not equal to the expected
one.public JListFixture requireToolTip(String expected)
JList matches the given value.requireToolTip in interface ToolTipDisplayFixtureexpected - the given value. It can be a regular expression.AssertionError - if the toolTip in this fixture's JList does not match the given value.public JListFixture requireToolTip(Pattern pattern)
JList matches the given regular expression
pattern.requireToolTip in interface ToolTipDisplayFixturepattern - the regular expression pattern to match.NullPointerException - if the given regular expression pattern is null.AssertionError - if the toolTip in this fixture's JList does not match the given regular
expression pattern.public Object clientProperty(Object key)
JList, under the given key.clientProperty in interface ClientPropertyStorageFixturekey - the key to use to retrieve the client property.null if the property was
not found.NullPointerException - if the given key is null.public JPopupMenuFixture showPopupMenu()
JList as the invoker of the pop-up menu.showPopupMenu in interface JPopupMenuInvokerFixtureIllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JList as the invoker of the pop-up
menu.showPopupMenuAt in interface JPopupMenuInvokerFixturep - the given point where to show the pop-up menu.IllegalStateException - if this fixture's JList is disabled.IllegalStateException - if this fixture's JList is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.public JListFixture cellReader(JListCellReader cellReader)
JListCellReader to use when comparing internal values of
this fixture's JList and the values expected in a test. The default implementation to use
is BasicJListCellReader.cellReader - the new JListCellValueReader to use.NullPointerException - if cellReader is null.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.