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
JLists:
- 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.JListFixtureJListFixture(Robot robot, JList target) Creates a new.JListFixture -
Method Summary
Modifier and TypeMethodDescriptioncellReader(JListCellReader cellReader) Updates the implementation ofto use when comparing internal values of this fixture'sJListCellReaderand the values expected in a test.JListClears the selection in this fixture's.JListclick()Simulates a user clicking this fixture's.JListclick(MouseButton button) Simulates a user clicking this fixture's.JListclick(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's.JListclickItem(int index) Simulates a user clicking an item in this fixture's.JList(package private) voidclickItem(int index, MouseButton button, int times) Simulates a user clicking an item in this fixture's.JListSimulates a user clicking an item in this fixture's.JListclientProperty(Object key) Returns the client property stored in this fixture's, under the given key.JListString[]contents()Returns theStringrepresentation of the elements in this fixture's, using this fixture'sJList.JListCellReaderprivate voidSimulates a user double-clicking this fixture's.JListdoubleClickItem(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.JListSimulates a drag operation at the location of the first item in this fixture'smatching the given value.JListSimulates a drag operation at the location of the first item in this fixture'smatching the given regular expression pattern.JListprotected final voiddriver(JListDriver newDriver) Sets theto be used by this fixture.JListDriverdrop()Simulates a user dropping an item at the center of this fixture's.JListdrop(int index) Simulates a user dropping an item to this fixture's.JListEnds 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.JListitem(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.JListpressAndReleaseKeys(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's.JListpressKey(int keyCode) Simulates a user pressing the given key on this fixture's.JListreleaseKey(int keyCode) Simulates a user releasing the given key on this fixture's.JListAsserts that this fixture'sis not enabled.JListAsserts that this fixture'sis enabled.JListrequireEnabled(Timeout timeout) Asserts that this fixture'sis enabled.JListAsserts that this fixture'shas input focus.JListrequireItemCount(int expected) Verifies that this fixture'shas the expected number of itemsJListVerifies that this fixture'sdoes not have any selection.JListAsserts that this fixture'sis not visible.JListrequireSelectedItems(int... indices) Verifies that the given item indices are selected in this fixture's.JListrequireSelectedItems(String... items) Verifies that theStringrepresentations of the selected items in this fixture'smatch the given text items.JListrequireSelectedItems(Pattern[] patterns) Verifies that theStringrepresentations of the selected items in this fixture'smatch the given regular expression patterns.JListrequireSelection(int index) Verifies that the index of the selected item in this fixture'sis equal to the given value.JListrequireSelection(String text) Verifies that theStringrepresentation of the selected item in this fixture'smatches the given text.JListrequireSelection(Pattern pattern) Verifies that theStringrepresentation of the selected item in this fixture'smatches the given regular expression pattern.JListrequireToolTip(String expected) Asserts that the toolTip in this fixture'smatches the given value.JListrequireToolTip(Pattern pattern) Asserts that the toolTip in this fixture'smatches the given regular expression pattern.JListAsserts that this fixture'sis visible.JListSimulates a user right-clicking this fixture's.JListString[]Returns theStringrepresentation of the selected elements in this fixture's, using this fixture'sJList.JListCellReaderselectItem(int index) Simulates a user selecting an item in this fixture's.JListselectItem(String text) Simulates a user selecting an item in this fixture's.JListselectItem(Pattern pattern) Simulates a user selecting an item in this fixture's.JListselectItems(int... indices) Simulates a user selecting the specified items in this fixture's.JListselectItems(String... items) Simulates a user selecting the specified items in this fixture's.JListselectItems(Pattern... patterns) Simulates a user selecting the specified items in this fixture's.JListselectItems(Range.From from, Range.To to) Simulates a user selecting the items (in the specified range) in this fixture's.JListShows a pop-up menu using this fixture'sas the invoker of the pop-up menu.JListshowPopupMenuAt(int index) Shows a pop-up menu at the location of the specified item in this fixture's.JListShows a pop-up menu at the given point using this fixture'sas the invoker of the pop-up menu.JListshowPopupMenuAt(String text) Shows a pop-up menu at the location of the first item matching the given value in this fixture's.JListshowPopupMenuAt(Pattern pattern) Shows a pop-up menu at the location of the first item matching the given regular expression pattern in this fixture's.JListvalueAt(int index) Returns theStringrepresentation of the value of an item in this fixture's, using this fixture'sJList.JListCellReaderMethods 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 theJListto find using the givenRobot.- Throws:
NullPointerException- ifrobotisnull.ComponentLookupException- if a matchingJListcould not be found.ComponentLookupException- if more than one matchingJListis found.
-
JListFixture
Creates a new.JListFixture- Parameters:
robot- performs simulation of user events on the givenJList.target- theJListto be managed by this fixture.- Throws:
NullPointerException- ifrobotisnull.NullPointerException- iftargetisnull.
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets theto be used by this fixture.JListDriver- Parameters:
newDriver- the newJListDriver.- Throws:
NullPointerException- if the given driver isnull.
-
valueAt
Returns theStringrepresentation of the value of an item in this fixture's, using this fixture'sJList.JListCellReader- Specified by:
valueAtin interfaceItemGroupFixture- Parameters:
index- the index of the item to return.- Returns:
- the
Stringrepresentation 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 theStringrepresentation of the elements in this fixture's, using this fixture'sJList.JListCellReader- Specified by:
contentsin interfaceItemGroupFixture- Returns:
- the
Stringrepresentation of the elements in this fixture'sJList. - See Also:
-
selection
Returns theStringrepresentation of the selected elements in this fixture's, using this fixture'sJList.JListCellReader- Returns:
- the
Stringrepresentation 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'sJListJListis enabled and showing.- Specified by:
clearSelectionin 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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. EachStringcan 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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:
selectItemin interfaceItemGroupFixture- Parameters:
index- the index of the item to select.- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis 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:
selectItemin interfaceItemGroupFixture- Parameters:
text- the text of the item to select. It can be a regular expression.- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis 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:
selectItemin interfaceItemGroupFixture- Parameters:
pattern- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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. Useanditem(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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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. Useanditem(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'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.LocationUnavailableException- if an element matching the givenStringcannot be found.
-
clickItem
-
click
Simulates a user clicking this fixture's.JList- Specified by:
clickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.
-
click
Simulates a user clicking this fixture's.JList- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
button- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenMouseButtonisnull.IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.
-
click
Simulates a user clicking this fixture's.JList- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
mouseClickInfo- specifies the button to click and the times the button should be clicked.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenMouseClickInfoisnull.IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's.JList- Specified by:
doubleClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's.JList- Specified by:
rightClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.
-
focus
Gives input focus to this fixture's.JList- Specified by:
focusin interfaceFocusableComponentFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis 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 availableJListmasks.InputEvent- Specified by:
pressAndReleaseKeyin interfaceKeyboardInputSimulationFixture- Parameters:
keyPressInfo- specifies the key and modifiers to press.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenKeyPressInfoisnull.IllegalArgumentException- if the given code is not a valid key code.IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.- See Also:
-
pressAndReleaseKeys
Simulates a user pressing and releasing the given keys on this fixture's.JList- Specified by:
pressAndReleaseKeysin 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'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's.JList- Specified by:
pressKeyin interfaceKeyboardInputSimulationFixture- Parameters:
keyCode- the code of the key to press.- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's.JList- Specified by:
releaseKeyin interfaceKeyboardInputSimulationFixture- Parameters:
keyCode- the code of the key to release.- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.- See Also:
-
drag
Simulates a drag operation at the location of the first item in this fixture'smatching 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'smatching the given regular expression pattern.JList- Parameters:
pattern- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'shas input focus.JList- Specified by:
requireFocusedin interfaceFocusableComponentFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJListdoes not have input focus.
-
requireEnabled
Asserts that this fixture'sis enabled.JList- Specified by:
requireEnabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJListis disabled.
-
requireEnabled
Asserts that this fixture'sis enabled.JList- Specified by:
requireEnabledin interfaceStateVerificationFixture- Parameters:
timeout- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError- if this fixture'sJListis never enabled.
-
requireDisabled
Asserts that this fixture'sis not enabled.JList- Specified by:
requireDisabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJListis enabled.
-
requireVisible
Asserts that this fixture'sis visible.JList- Specified by:
requireVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJListis not visible.
-
requireNotVisible
Asserts that this fixture'sis not visible.JList- Specified by:
requireNotVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJListis visible.
-
requireSelection
Verifies that theStringrepresentation of the selected item in this fixture'smatches the given text.JList- Specified by:
requireSelectionin 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 theStringrepresentation of the selected item in this fixture'smatches the given regular expression pattern.JList- Specified by:
requireSelectionin 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'sis equal to the given value.JList- Specified by:
requireSelectionin 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 theStringrepresentations of the selected items in this fixture'smatch the given text items.JList- Parameters:
items- text items to match. EachStringcan 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 theStringrepresentations of the selected items in this fixture'smatch 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'sJListdoes not match the given one.- Since:
- 1.2
-
requireNoSelection
Verifies that this fixture'sdoes not have any selection.JList- Specified by:
requireNoSelectionin interfaceItemGroupFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJListhas a selection.
-
requireItemCount
Verifies that this fixture'shas the expected number of itemsJList- Specified by:
requireItemCountin interfaceItemGroupFixture- Parameters:
expected- the expected number of items.- Returns:
- this fixture.
- Throws:
AssertionError- if the number of items in this fixture'sJListis not equal to the expected one.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture'smatches the given value.JList- Specified by:
requireToolTipin interfaceToolTipDisplayFixture- Parameters:
expected- the given value. It can be a regular expression.- Returns:
- this fixture.
- Throws:
AssertionError- if the toolTip in this fixture'sJListdoes not match the given value.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture'smatches the given regular expression pattern.JList- Specified by:
requireToolTipin 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'sJListdoes 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:
clientPropertyin 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
nullif the property was not found. - Throws:
NullPointerException- if the given key isnull.- Since:
- 1.2
-
showPopupMenu
Shows a pop-up menu using this fixture'sas the invoker of the pop-up menu.JList- Specified by:
showPopupMenuin interfaceJPopupMenuInvokerFixture- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis 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'sas the invoker of the pop-up menu.JList- Specified by:
showPopupMenuAtin 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'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.ComponentLookupException- if a pop-up menu cannot be found.
-
cellReader
Updates the implementation ofto use when comparing internal values of this fixture'sJListCellReaderand the values expected in a test. The default implementation to use isJList.BasicJListCellReader- Parameters:
cellReader- the newJListCellValueReaderto use.- Returns:
- this fixture.
- Throws:
NullPointerException- ifcellReaderisnull.
-