Package org.fest.swing.fixture
Class JListFixture
- All Implemented Interfaces:
ClientPropertyStorageFixture
,CommonComponentFixture
,FocusableComponentFixture
,ItemGroupFixture
,JComponentFixture
,JPopupMenuInvokerFixture
,KeyboardInputSimulationFixture
,MouseInputSimulationFixture
,StateVerificationFixture
,ToolTipDisplayFixture
public class JListFixture
extends ComponentFixture<JList>
implements CommonComponentFixture, ItemGroupFixture, JComponentFixture, JPopupMenuInvokerFixture
Understands functional testing of
JList
s:
- user input simulation
- state verification
- property value query
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
-
Field Summary
FieldsFields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
-
Constructor Summary
ConstructorsConstructorDescriptionJListFixture
(Robot robot, String listName) Creates a new
.JListFixture
JListFixture
(Robot robot, JList target) Creates a new
.JListFixture
-
Method Summary
Modifier and TypeMethodDescriptioncellReader
(JListCellReader cellReader) Updates the implementation of
to use when comparing internal values of this fixture'sJListCellReader
and the values expected in a test.JList
Clears the selection in this fixture's
.JList
click()
Simulates a user clicking this fixture's
.JList
click
(MouseButton button) Simulates a user clicking this fixture's
.JList
click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's
.JList
clickItem
(int index) Simulates a user clicking an item in this fixture's
.JList
(package private) void
clickItem
(int index, MouseButton button, int times) Simulates a user clicking an item in this fixture's
.JList
Simulates a user clicking an item in this fixture's
.JList
clientProperty
(Object key) Returns the client property stored in this fixture's
, under the given key.JList
String[]
contents()
Returns theString
representation of the elements in this fixture's
, using this fixture'sJList
.JListCellReader
private void
Simulates a user double-clicking this fixture's
.JList
doubleClickItem
(int index) Deprecated.to be removed in version 2.0.doubleClickItem
(String text) Deprecated.to be removed in version 2.0.drag
(int index) Simulates a user dragging an item from this fixture's
.JList
Simulates a drag operation at the location of the first item in this fixture's
matching the given value.JList
Simulates a drag operation at the location of the first item in this fixture's
matching the given regular expression pattern.JList
protected final void
driver
(JListDriver newDriver) Sets the
to be used by this fixture.JListDriver
drop()
Simulates a user dropping an item at the center of this fixture's
.JList
drop
(int index) Simulates a user dropping an item to this fixture's
.JList
Ends a drag operation at the location of the first item matching the given value.Ends a drag operation at the location of the first item matching the given regular expression pattern.focus()
Gives input focus to this fixture's
.JList
item
(int index) Returns a fixture that manages the list item specified by the given index.Returns a fixture that manages the list item specified by the given text.Returns a fixture that manages the list item whose text matches the given regular expression pattern.pressAndReleaseKey
(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's
.JList
pressAndReleaseKeys
(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's
.JList
pressKey
(int keyCode) Simulates a user pressing the given key on this fixture's
.JList
releaseKey
(int keyCode) Simulates a user releasing the given key on this fixture's
.JList
Asserts that this fixture's
is not enabled.JList
Asserts that this fixture's
is enabled.JList
requireEnabled
(Timeout timeout) Asserts that this fixture's
is enabled.JList
Asserts that this fixture's
has input focus.JList
requireItemCount
(int expected) Verifies that this fixture's
has the expected number of itemsJList
Verifies that this fixture's
does not have any selection.JList
Asserts that this fixture's
is not visible.JList
requireSelectedItems
(int... indices) Verifies that the given item indices are selected in this fixture's
.JList
requireSelectedItems
(String... items) Verifies that theString
representations of the selected items in this fixture's
match the given text items.JList
requireSelectedItems
(Pattern[] patterns) Verifies that theString
representations of the selected items in this fixture's
match the given regular expression patterns.JList
requireSelection
(int index) Verifies that the index of the selected item in this fixture's
is equal to the given value.JList
requireSelection
(String text) Verifies that theString
representation of the selected item in this fixture's
matches the given text.JList
requireSelection
(Pattern pattern) Verifies that theString
representation of the selected item in this fixture's
matches the given regular expression pattern.JList
requireToolTip
(String expected) Asserts that the toolTip in this fixture's
matches the given value.JList
requireToolTip
(Pattern pattern) Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JList
Asserts that this fixture's
is visible.JList
Simulates a user right-clicking this fixture's
.JList
String[]
Returns theString
representation of the selected elements in this fixture's
, using this fixture'sJList
.JListCellReader
selectItem
(int index) Simulates a user selecting an item in this fixture's
.JList
selectItem
(String text) Simulates a user selecting an item in this fixture's
.JList
selectItem
(Pattern pattern) Simulates a user selecting an item in this fixture's
.JList
selectItems
(int... indices) Simulates a user selecting the specified items in this fixture's
.JList
selectItems
(String... items) Simulates a user selecting the specified items in this fixture's
.JList
selectItems
(Pattern... patterns) Simulates a user selecting the specified items in this fixture's
.JList
selectItems
(Range.From from, Range.To to) Simulates a user selecting the items (in the specified range) in this fixture's
.JList
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.JList
showPopupMenuAt
(int index) Shows a pop-up menu at the location of the specified item in this fixture's
.JList
Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up menu.JList
showPopupMenuAt
(String text) Shows a pop-up menu at the location of the first item matching the given value in this fixture's
.JList
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
.JList
valueAt
(int index) Returns theString
representation of the value of an item in this fixture's
, using this fixture'sJList
.JListCellReader
Methods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
-
Field Details
-
driver
-
-
Constructor Details
-
JListFixture
Creates a new
.JListFixture
- Parameters:
robot
- performs simulation of user events on aJList
.listName
- the name of theJList
to find using the givenRobot
.- Throws:
NullPointerException
- ifrobot
isnull
.ComponentLookupException
- if a matchingJList
could not be found.ComponentLookupException
- if more than one matchingJList
is found.
-
JListFixture
Creates a new
.JListFixture
- Parameters:
robot
- performs simulation of user events on the givenJList
.target
- theJList
to be managed by this fixture.- Throws:
NullPointerException
- ifrobot
isnull
.NullPointerException
- iftarget
isnull
.
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets the
to be used by this fixture.JListDriver
- Parameters:
newDriver
- the newJListDriver
.- Throws:
NullPointerException
- if the given driver isnull
.
-
valueAt
Returns theString
representation of the value of an item in this fixture's
, using this fixture'sJList
.JListCellReader
- Specified by:
valueAt
in interfaceItemGroupFixture
- Parameters:
index
- the index of the item to return.- Returns:
- the
String
representation of the value of an item in this fixture'sJList
. - Throws:
IndexOutOfBoundsException
- if the given index is negative or greater than the index of the last item in theJList
.- See Also:
-
contents
Returns theString
representation of the elements in this fixture's
, using this fixture'sJList
.JListCellReader
- Specified by:
contents
in interfaceItemGroupFixture
- Returns:
- the
String
representation of the elements in this fixture'sJList
. - See Also:
-
selection
Returns theString
representation of the selected elements in this fixture's
, using this fixture'sJList
.JListCellReader
- Returns:
- the
String
representation of the selected elements in this fixture'sJList
. - See Also:
-
item
Returns a fixture that manages the list item specified by the given index.- Parameters:
index
- of the item.- Returns:
- a fixture that manages the list item specified by the given index.
- Throws:
IndexOutOfBoundsException
- if the index is out of bounds.
-
item
Returns a fixture that manages the list item specified by the given text.- Parameters:
text
- the text of the item. It can be a regular expression.- Returns:
- a fixture that manages the list item specified by the given text.
- Throws:
LocationUnavailableException
- if an element matching the given text cannot be found.
-
item
Returns a fixture that manages the list item whose text matches the given regular expression pattern.- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- a fixture that manages the list item whose text matches the given regular expression pattern.
- Throws:
LocationUnavailableException
- if an element matching the given text cannot be found.NullPointerException
- if the given regular expression pattern isnull
.- Since:
- 1.2
-
clearSelection
Clears the selection in this fixture's
. Since this method does not simulate user input, it does not verifies that this fixture'sJList
JList
is enabled and showing.- Specified by:
clearSelection
in interfaceItemGroupFixture
- Returns:
- this fixture.
- Since:
- 1.2
-
selectItems
Simulates a user selecting the items (in the specified range) in this fixture's
.JList
- Parameters:
from
- the starting point of the selection.to
- the last item to select (inclusive.)- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.IndexOutOfBoundsException
- if the any index is negative or greater than the index of the last item in theJList
.
-
selectItems
Simulates a user selecting the specified items in this fixture's
.JList
- Parameters:
indices
- the indices of the items to select.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given array isnull
.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 theJList
.IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.
-
selectItems
Simulates a user selecting the specified items in this fixture's
. The items to select should match the given values.JList
- Parameters:
items
- the text of the items to select. EachString
can be a regular expression.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given array isnull
.IllegalArgumentException
- if the given array is empty.IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.LocationUnavailableException
- if an element matching the any of the given values cannot be found.- See Also:
-
selectItems
Simulates a user selecting the specified items in this fixture's
. The items to select should select the given regular expression patterns.JList
- Parameters:
patterns
- the regular expression patterns to match.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given array isnull
.NullPointerException
- if any of the regular expression patterns isnull
.IllegalArgumentException
- if the given array is empty.IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.LocationUnavailableException
- if an element matching the any of the given regular expression patterns cannot be found.- Since:
- 1.2
- See Also:
-
selectItem
Simulates a user selecting an item in this fixture's
.JList
- Specified by:
selectItem
in interfaceItemGroupFixture
- Parameters:
index
- the index of the item to select.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.IndexOutOfBoundsException
- if the given index is negative or greater than the index of the last item in theJList
.- See Also:
-
selectItem
Simulates a user selecting an item in this fixture's
.JList
- Specified by:
selectItem
in interfaceItemGroupFixture
- Parameters:
text
- the text of the item to select. It can be a regular expression.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.LocationUnavailableException
- if an element matching the given text cannot be found.- See Also:
-
selectItem
Simulates a user selecting an item in this fixture's
. The value of the item to select must match the given regular expression pattern.JList
- Specified by:
selectItem
in interfaceItemGroupFixture
- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.LocationUnavailableException
- if an element matching the given text cannot be found.NullPointerException
- if the given regular expression pattern isnull
.- Since:
- 1.2
- See Also:
-
clickItem
Simulates a user clicking an item in this fixture's
.JList
- Parameters:
index
- the index of the item to clicking.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.IndexOutOfBoundsException
- if the given index is negative or greater than the index of the last item in theJList
.- Since:
- 1.2
- See Also:
-
clickItem
Simulates a user clicking an item in this fixture's
.JList
- Parameters:
text
- the text of the item to select. It can be a regular expression.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.LocationUnavailableException
- if an element matching the given text cannot be found.- Since:
- 1.2
- See Also:
-
clickItem
Simulates a user clicking an item in this fixture's
. The value of the item to select must match the given regular expression pattern.JList
- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.LocationUnavailableException
- if an element matching the given text cannot be found.NullPointerException
- if the given regular expression pattern isnull
.- Since:
- 1.2
- See Also:
-
doubleClickItem
Deprecated.to be removed in version 2.0. Use
anditem(int)
instead.JListItemFixture.doubleClick()
Simulates a user double-clicking an item in this fixture's
.JList
- Parameters:
index
- the index of the item to double-click.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.IndexOutOfBoundsException
- if the given index is negative or greater than the index of the last item in theJList
.
-
doubleClickItem
Deprecated.to be removed in version 2.0. Use
anditem(String)
instead.JListItemFixture.doubleClick()
Simulates a user double-clicking an item in this fixture's
.JList
- Parameters:
text
- the text of the item to double-click.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.LocationUnavailableException
- if an element matching the givenString
cannot be found.
-
clickItem
-
click
Simulates a user clicking this fixture's
.JList
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JList
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
button
- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseButton
isnull
.IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JList
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
mouseClickInfo
- specifies the button to click and the times the button should be clicked.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseClickInfo
isnull
.IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's
.JList
- Specified by:
doubleClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's
.JList
- Specified by:
rightClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.
-
focus
Gives input focus to this fixture's
.JList
- Specified by:
focus
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.
-
pressAndReleaseKey
Simulates a user pressing given key with the given modifiers on this fixture's
. Modifiers is a mask from the availableJList
masks.InputEvent
- Specified by:
pressAndReleaseKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyPressInfo
- specifies the key and modifiers to press.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenKeyPressInfo
isnull
.IllegalArgumentException
- if the given code is not a valid key code.IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.- See Also:
-
pressAndReleaseKeys
Simulates a user pressing and releasing the given keys on this fixture's
.JList
- Specified by:
pressAndReleaseKeys
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCodes
- one or more codes of the keys to press.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given array of codes isnull
.IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's
.JList
- Specified by:
pressKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCode
- the code of the key to press.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's
.JList
- Specified by:
releaseKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCode
- the code of the key to release.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.- See Also:
-
drag
Simulates a drag operation at the location of the first item in this fixture's
matching the given value.JList
- Parameters:
text
- the text of the item to drag. It can be a regular expression.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.LocationUnavailableException
- if an element matching the given text cannot be found.- See Also:
-
drop
Ends a drag operation at the location of the first item matching the given value.- Parameters:
text
- the text of the item to drop. It can be a regular expression.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
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.
-
drag
Simulates a drag operation at the location of the first item in this fixture's
matching the given regular expression pattern.JList
- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.NullPointerException
- if the given regular expression pattern innull
.LocationUnavailableException
- if an element matching the given regular expression pattern cannot be found.- Since:
- 1.2
- See Also:
-
drop
Ends a drag operation at the location of the first item matching the given regular expression pattern.- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.NullPointerException
- if the given regular expression pattern innull
.LocationUnavailableException
- if an element matching the given text cannot be found.ActionFailedException
- if there is no drag action in effect.- Since:
- 1.2
- See Also:
-
drop
Simulates a user dropping an item at the center of this fixture's
.JList
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.ActionFailedException
- if there is no drag action in effect.
-
drag
Simulates a user dragging an item from this fixture's
.JList
- Parameters:
index
- the index of the item to drag.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.IndexOutOfBoundsException
- if the given index is negative or greater than the index of the last item in theJList
.
-
drop
Simulates a user dropping an item to this fixture's
.JList
- Parameters:
index
- the index of the item to drop.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.IndexOutOfBoundsException
- if the given index is negative or greater than the index of the last item in theJList
.ActionFailedException
- if there is no drag action in effect.
-
showPopupMenuAt
Shows a pop-up menu at the location of the specified item in this fixture's
.JList
- Parameters:
index
- the index of the item.- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
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 theJList
.
-
showPopupMenuAt
Shows a pop-up menu at the location of the first item matching the given value in this fixture's
.JList
- Parameters:
text
- the text of the item. It can be a regular expression.- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
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.
-
showPopupMenuAt
Shows a pop-up menu at the location of the first item matching the given regular expression pattern in this fixture's
.JList
- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.NullPointerException
- if the given regular expression pattern isnull
.ComponentLookupException
- if a pop-up menu cannot be found.LocationUnavailableException
- if an element matching the given value cannot be found.- Since:
- 1.2
-
requireFocused
Asserts that this fixture's
has input focus.JList
- Specified by:
requireFocused
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJList
does not have input focus.
-
requireEnabled
Asserts that this fixture's
is enabled.JList
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJList
is disabled.
-
requireEnabled
Asserts that this fixture's
is enabled.JList
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Parameters:
timeout
- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError
- if this fixture'sJList
is never enabled.
-
requireDisabled
Asserts that this fixture's
is not enabled.JList
- Specified by:
requireDisabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJList
is enabled.
-
requireVisible
Asserts that this fixture's
is visible.JList
- Specified by:
requireVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJList
is not visible.
-
requireNotVisible
Asserts that this fixture's
is not visible.JList
- Specified by:
requireNotVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJList
is visible.
-
requireSelection
Verifies that theString
representation of the selected item in this fixture's
matches the given text.JList
- Specified by:
requireSelection
in interfaceItemGroupFixture
- Parameters:
text
- the text to match. It can be a regular expression pattern.- Returns:
- this fixture.
- Throws:
AssertionError
- if the selected item does not match the given text.- See Also:
-
requireSelection
Verifies that theString
representation of the selected item in this fixture's
matches the given regular expression pattern.JList
- Specified by:
requireSelection
in interfaceItemGroupFixture
- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
AssertionError
- if the selected item does not match the given regular expression pattern.NullPointerException
- if the given regular expression pattern isnull
.- Since:
- 1.2
- See Also:
-
requireSelection
Verifies that the index of the selected item in this fixture's
is equal to the given value.JList
- Specified by:
requireSelection
in interfaceItemGroupFixture
- Parameters:
index
- the expected selection index.- Returns:
- this fixture.
- Throws:
AssertionError
- if the selected index is not equal to the given one.- Since:
- 1.2
-
requireSelectedItems
Verifies that theString
representations of the selected items in this fixture's
match the given text items.JList
- Parameters:
items
- text items to match. EachString
can be a regular expression.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given array isnull
.IllegalArgumentException
- if the given array is empty.AssertionError
- if the selected items do not match the given text items.- See Also:
-
requireSelectedItems
Verifies that theString
representations of the selected items in this fixture's
match the given regular expression patterns.JList
- Parameters:
patterns
- the regular expression patterns to match.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given array isnull
.IllegalArgumentException
- if the given array is empty.NullPointerException
- if any of the patterns in the given array isnull
.AssertionError
- if the selected items do not match the given regular expression patterns.- Since:
- 1.2
- See Also:
-
requireSelectedItems
Verifies that the given item indices are selected in this fixture's
.JList
- Parameters:
indices
- the expected indices of the selected items.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given array isnull
.IllegalArgumentException
- if the given array is empty.AssertionError
- if the selection in this fixture'sJList
does not match the given one.- Since:
- 1.2
-
requireNoSelection
Verifies that this fixture's
does not have any selection.JList
- Specified by:
requireNoSelection
in interfaceItemGroupFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJList
has a selection.
-
requireItemCount
Verifies that this fixture's
has the expected number of itemsJList
- Specified by:
requireItemCount
in interfaceItemGroupFixture
- Parameters:
expected
- the expected number of items.- Returns:
- this fixture.
- Throws:
AssertionError
- if the number of items in this fixture'sJList
is not equal to the expected one.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture's
matches the given value.JList
- Specified by:
requireToolTip
in interfaceToolTipDisplayFixture
- Parameters:
expected
- the given value. It can be a regular expression.- Returns:
- this fixture.
- Throws:
AssertionError
- if the toolTip in this fixture'sJList
does not match the given value.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JList
- Specified by:
requireToolTip
in interfaceToolTipDisplayFixture
- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given regular expression pattern isnull
.AssertionError
- if the toolTip in this fixture'sJList
does not match the given regular expression pattern.- Since:
- 1.2
-
clientProperty
Returns the client property stored in this fixture's
, under the given key.JList
- Specified by:
clientProperty
in interfaceClientPropertyStorageFixture
- Parameters:
key
- the key to use to retrieve the client property.- Returns:
- the value of the client property stored under the given key, or
null
if the property was not found. - Throws:
NullPointerException
- if the given key isnull
.- Since:
- 1.2
-
showPopupMenu
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.JList
- Specified by:
showPopupMenu
in interfaceJPopupMenuInvokerFixture
- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.
-
showPopupMenuAt
Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up menu.JList
- Specified by:
showPopupMenuAt
in interfaceJPopupMenuInvokerFixture
- Parameters:
p
- the given point where to show the pop-up menu.- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.
-
cellReader
Updates the implementation of
to use when comparing internal values of this fixture'sJListCellReader
and the values expected in a test. The default implementation to use isJList
.BasicJListCellReader
- Parameters:
cellReader
- the newJListCellValueReader
to use.- Returns:
- this fixture.
- Throws:
NullPointerException
- ifcellReader
isnull
.
-