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
JList
s:
- 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 JListItemFixture
click()
Simulates a user clicking this fixture's list item.final JListItemFixture
click
(MouseButton button) Simulates a user clicking this fixture's list item.final JListItemFixture
click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's list item.final JListItemFixture
Simulates a user double-clicking this fixture's list item.final JListItemFixture
drag()
Simulates a user dragging this fixture's list item.final JListItemFixture
drop()
Simulates a user dropping into this fixture's list item.final int
index()
Returns the index of this fixture's list item.final JListItemFixture
Simulates a user right-clicking this fixture's list item.final JListItemFixture
select()
Simulates a user selecting this fixture's list item.final JPopupMenuFixture
Shows a pop-up menu using this fixture's list item as the invoker of the pop-up menu.final String
value()
Returns theString
representation of the value of this fixture's list item, using the
from theJListCellReader
that created thisJListFixture
.JListItemFixture
-
Field Details
-
list
-
index
final int index
-
-
Constructor Details
-
JListItemFixture
Creates a newJListItemFixture
.- Parameters:
list
- manages theJList
containing the list item to be managed by this fixture.index
- index of the list item to be managed by this fixture.- Throws:
NullPointerException
- iflist
isnull
.
-
-
Method Details
-
select
Simulates a user selecting this fixture's list item.- Specified by:
select
in interfaceItemFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is 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:
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.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:
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.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:
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.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:
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.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:
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.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:
showPopupMenu
in interfaceItemFixture
- 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.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 theString
representation of the value of this fixture's list item, using the
from theJListCellReader
that created thisJListFixture
.JListItemFixture
- Specified by:
value
in interfaceItemFixture
- Returns:
- the
String
representation 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:
drag
in interfaceItemFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is 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:
drop
in interfaceItemFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJList
is disabled.IllegalStateException
- if this fixture'sJList
is 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.
-