org.fest.swing.fixture
Class JListItemFixture

java.lang.Object
  extended by org.fest.swing.fixture.JListItemFixture
All Implemented Interfaces:
ItemFixture, MouseInputSimulationFixture

public class JListItemFixture
extends Object
implements ItemFixture

Understands functional testing of single rows in JLists:

Author:
Yvonne Wang, Alex Ruiz

Constructor Summary
JListItemFixture(JListFixture list, int index)
          Creates a new JListItemFixture.
 
Method Summary
 JListItemFixture click()
          Simulates a user clicking this fixture's list item.
 JListItemFixture click(MouseButton button)
          Simulates a user clicking this fixture's list item.
 JListItemFixture click(MouseClickInfo mouseClickInfo)
          Simulates a user clicking this fixture's list item.
 JListItemFixture doubleClick()
          Simulates a user double-clicking this fixture's list item.
 JListItemFixture drag()
          Simulates a user dragging this fixture's list item.
 JListItemFixture drop()
          Simulates a user dropping into this fixture's list item.
 int index()
          Returns the index of this fixture's list item.
 JListItemFixture rightClick()
          Simulates a user right-clicking this fixture's list item.
 JListItemFixture select()
          Simulates a user selecting this fixture's list item.
 JPopupMenuFixture showPopupMenu()
          Shows a pop-up menu using this fixture's list item as the invoker of the pop-up menu.
 String value()
          Returns the String representation of the value of this fixture's list item, using the JListCellReader from the JListFixture that created this JListItemFixture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JListItemFixture

public JListItemFixture(JListFixture list,
                        int index)
Creates a new JListItemFixture.

Parameters:
list - manages the JList containing the list item to be managed by this fixture.
index - index of the list item to be managed by this fixture.
Throws:
NullPointerException - if list is null.
Method Detail

select

public final JListItemFixture select()
Simulates a user selecting this fixture's list item.

Specified by:
select in interface ItemFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JList is disabled.
IllegalStateException - if this fixture's JList is not showing on the screen.
IndexOutOfBoundsException - if this item's index is negative or greater than the index of the last item in the JList.

click

public final JListItemFixture click()
Simulates a user clicking this fixture's list item.

Specified by:
click in interface MouseInputSimulationFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JList is disabled.
IllegalStateException - if this fixture's JList is not showing on the screen.
IndexOutOfBoundsException - if this item's index is negative or greater than the index of the last item in the JList.

click

public final JListItemFixture click(MouseButton button)
Simulates a user clicking this fixture's list item.

Specified by:
click in interface MouseInputSimulationFixture
Parameters:
button - the button to click.
Returns:
this fixture.
Throws:
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.
IndexOutOfBoundsException - if this item's index is negative or greater than the index of the last item in the JList.

click

public final JListItemFixture click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's list item.

Specified by:
click in interface MouseInputSimulationFixture
Parameters:
mouseClickInfo - specifies the button to click and the times the button should be clicked.
Returns:
this fixture.
Throws:
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.
IndexOutOfBoundsException - if this item's index is negative or greater than the index of the last item in the JList.

doubleClick

public final JListItemFixture doubleClick()
Simulates a user double-clicking this fixture's list item.

Specified by:
doubleClick in interface MouseInputSimulationFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JList is disabled.
IllegalStateException - if this fixture's JList is not showing on the screen.
IndexOutOfBoundsException - if this item's index is negative or greater than the index of the last item in the JList.

rightClick

public final JListItemFixture rightClick()
Simulates a user right-clicking this fixture's list item.

Specified by:
rightClick in interface MouseInputSimulationFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JList is disabled.
IllegalStateException - if this fixture's JList is not showing on the screen.
IndexOutOfBoundsException - if this item's index is negative or greater than the index of the last item in the JList.

showPopupMenu

public final JPopupMenuFixture showPopupMenu()
Shows a pop-up menu using this fixture's list item as the invoker of the pop-up menu.

Specified by:
showPopupMenu in interface ItemFixture
Returns:
a fixture that manages the displayed pop-up menu.
Throws:
IllegalStateException - if this fixture's JList is disabled.
IllegalStateException - if this fixture's JList is not showing on the screen.
IndexOutOfBoundsException - if this item's index is negative or greater than the index of the last item in the JList.
ComponentLookupException - if a pop-up menu cannot be found.

value

public final String value()
Returns the String representation of the value of this fixture's list item, using the JListCellReader from the JListFixture that created this JListItemFixture.

Specified by:
value in interface ItemFixture
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 the JList.
See Also:
JListFixture.cellReader(JListCellReader)

drag

public final JListItemFixture drag()
Simulates a user dragging this fixture's list item.

Specified by:
drag in interface ItemFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JList is disabled.
IllegalStateException - if this fixture's JList is not showing on the screen.
IndexOutOfBoundsException - if this item's index is negative or greater than the index of the last item in the JList.

drop

public final JListItemFixture drop()
Simulates a user dropping into this fixture's list item.

Specified by:
drop in interface ItemFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JList is disabled.
IllegalStateException - if this fixture's JList is not showing on the screen.
IndexOutOfBoundsException - if this item's index is negative or greater than the index of the last item in the JList.
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.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.