Package org.fest.swing.fixture
Class JListItemFixture
java.lang.Object
org.fest.swing.fixture.JListItemFixture
- All Implemented Interfaces:
ItemFixture,MouseInputSimulationFixture
Understands functional testing of single rows in
JLists:
- user input simulation
- state verification
- property value query
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int(package private) final JListFixture -
Constructor Summary
ConstructorsConstructorDescriptionJListItemFixture(JListFixture list, int index) Creates a newJListItemFixture. -
Method Summary
Modifier and TypeMethodDescriptionfinal JListItemFixtureclick()Simulates a user clicking this fixture's list item.final JListItemFixtureclick(MouseButton button) Simulates a user clicking this fixture's list item.final JListItemFixtureclick(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's list item.final JListItemFixtureSimulates a user double-clicking this fixture's list item.final JListItemFixturedrag()Simulates a user dragging this fixture's list item.final JListItemFixturedrop()Simulates a user dropping into this fixture's list item.final intindex()Returns the index of this fixture's list item.final JListItemFixtureSimulates a user right-clicking this fixture's list item.final JListItemFixtureselect()Simulates a user selecting this fixture's list item.final JPopupMenuFixtureShows a pop-up menu using this fixture's list item as the invoker of the pop-up menu.final Stringvalue()Returns theStringrepresentation of the value of this fixture's list item, using thefrom theJListCellReaderthat created thisJListFixture.JListItemFixture
-
Field Details
-
list
-
index
final int index
-
-
Constructor Details
-
JListItemFixture
Creates a newJListItemFixture.- Parameters:
list- manages theJListcontaining the list item to be managed by this fixture.index- index of the list item to be managed by this fixture.- Throws:
NullPointerException- iflistisnull.
-
-
Method Details
-
select
Simulates a user selecting this fixture's list item.- Specified by:
selectin interfaceItemFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.
-
click
Simulates a user clicking this fixture's list item.- Specified by:
clickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.
-
click
Simulates a user clicking this fixture's list item.- 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.IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.
-
click
Simulates a user clicking this fixture's list item.- 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.IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.
-
doubleClick
Simulates a user double-clicking this fixture's list item.- Specified by:
doubleClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.
-
rightClick
Simulates a user right-clicking this fixture's list item.- Specified by:
rightClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.
-
showPopupMenu
Shows a pop-up menu using this fixture's list item as the invoker of the pop-up menu.- Specified by:
showPopupMenuin interfaceItemFixture- 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.IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.ComponentLookupException- if a pop-up menu cannot be found.
-
value
Returns theStringrepresentation of the value of this fixture's list item, using thefrom theJListCellReaderthat created thisJListFixture.JListItemFixture- Specified by:
valuein interfaceItemFixture- Returns:
- the
Stringrepresentation of the value of this fixture's list item. - Throws:
IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.- See Also:
-
drag
Simulates a user dragging this fixture's list item.- Specified by:
dragin interfaceItemFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.
-
drop
Simulates a user dropping into this fixture's list item.- Specified by:
dropin interfaceItemFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJListis disabled.IllegalStateException- if this fixture'sJListis not showing on the screen.IndexOutOfBoundsException- if this item's index is negative or greater than the index of the last item in theJList.ActionFailedException- if there is no drag action in effect.
-
index
public final int index()Returns the index of this fixture's list item.- Returns:
- the index of this fixture's list item.
-