Class JTableHeaderFixture

java.lang.Object
org.fest.swing.fixture.ComponentFixture<JTableHeader>
org.fest.swing.fixture.JTableHeaderFixture
All Implemented Interfaces:
ClientPropertyStorageFixture, JComponentFixture, ToolTipDisplayFixture

public class JTableHeaderFixture extends ComponentFixture<JTableHeader> implements JComponentFixture
Understands functional testing of JTableHeaders:
  • user input simulation
  • state verification
  • property value query
  • Field Details

  • Constructor Details

  • Method Details

    • driver

      protected final void driver(JTableHeaderDriver newDriver)
      Sets the JTableHeaderDriver to be used by this fixture.
      Parameters:
      newDriver - the new JTableHeaderDriver.
      Throws:
      NullPointerException - if the given driver is null.
    • clickColumn

      public JTableHeaderFixture clickColumn(int index)
      Simulates a user clicking the column under the given index, in this fixture's JTableHeader.
      Parameters:
      index - the index of the column to click.
      Returns:
      this fixture.
      Throws:
      IllegalStateException - if this fixture's JTableHeader is disabled.
      IllegalStateException - if this fixture's JTableHeader is not showing on the screen.
      IndexOutOfBoundsException - if the index is out of bounds.
    • showPopupMenuAt

      public JPopupMenuFixture showPopupMenuAt(int columnIndex)
      Shows a pop-up menu using this fixture's JTableHeader as the invoker of the pop-up menu.
      Parameters:
      columnIndex - the index of the column where the pop-up menu will be displayed.
      Returns:
      a fixture that manages the displayed pop-up menu.
      Throws:
      IllegalStateException - if this fixture's JTableHeader is disabled.
      IllegalStateException - if this fixture's JTableHeader is not showing on the screen.
      IndexOutOfBoundsException - if the index is out of bounds.
      ComponentLookupException - if a pop-up menu cannot be found.
    • showPopupMenuAt

      public JPopupMenuFixture showPopupMenuAt(String columnName)
      Shows a pop-up menu using this fixture's JTableHeader as the invoker of the pop-up menu.
      Parameters:
      columnName - the name of the column where the pop-up menu will be displayed. It can be a regular expression.
      Returns:
      a fixture that manages the displayed pop-up menu.
      Throws:
      IllegalStateException - if this fixture's JTableHeader is disabled.
      IllegalStateException - if this fixture's JTableHeader is not showing on the screen.
      ComponentLookupException - if a pop-up menu cannot be found.
    • showPopupMenuAt

      public JPopupMenuFixture showPopupMenuAt(Pattern columnNamePattern)
      Shows a pop-up menu using this fixture's JTableHeader as the invoker of the pop-up menu. The name of the column to use must match the given regular expression pattern.
      Parameters:
      columnNamePattern - the regular expression pattern to match.
      Returns:
      a fixture that manages the displayed pop-up menu.
      Throws:
      IllegalStateException - if this fixture's JTableHeader is disabled.
      IllegalStateException - if this fixture's JTableHeader is not showing on the screen.
      NullPointerException - if the given regular expression pattern is null.
      ComponentLookupException - if a pop-up menu cannot be found.
      Since:
      1.2
    • clickColumn

      public JTableHeaderFixture clickColumn(int index, MouseClickInfo mouseClickInfo)
      Simulates a user clicking the column under the given index, in this fixture's JTableHeader, using the given mouse button, the given number of times.
      Parameters:
      index - the index of the column to click.
      mouseClickInfo - specifies the mouse button to use and the number of times to click.
      Returns:
      this fixture.
      Throws:
      NullPointerException - if the given MouseClickInfo is null.
      IllegalStateException - if this fixture's JTableHeader is disabled.
      IllegalStateException - if this fixture's JTableHeader is not showing on the screen.
      IndexOutOfBoundsException - if the index is out of bounds.
    • clickColumn

      public JTableHeaderFixture clickColumn(String columnName)
      Simulates a user clicking the column which name matches the given value, in this fixture's JTableHeader.
      Parameters:
      columnName - the column name to match. It can be a regular expression.
      Returns:
      this fixture.
      Throws:
      IllegalStateException - if this fixture's JTableHeader is disabled.
      IllegalStateException - if this fixture's JTableHeader is not showing on the screen.
      LocationUnavailableException - if a column with a matching name cannot be found.
    • clickColumn

      public JTableHeaderFixture clickColumn(Pattern columnNamePattern)
      Simulates a user clicking the column which name matches the given regular expression pattern, in this fixture's JTableHeader.
      Parameters:
      columnNamePattern - the regular expression pattern to match.
      Returns:
      this fixture.
      Throws:
      IllegalStateException - if this fixture's JTableHeader is disabled.
      IllegalStateException - if this fixture's JTableHeader is not showing on the screen.
      NullPointerException - if the given regular expression is null.
      LocationUnavailableException - if a column with a matching name cannot be found.
      Since:
      1.2
    • clickColumn

      public JTableHeaderFixture clickColumn(String columnName, MouseClickInfo mouseClickInfo)
      Simulates a user clicking the column which name matches the given one, in this fixture's JTableHeader, using the given mouse button, the given number of times.
      Parameters:
      columnName - the column name to match. It can be a regular expression.
      mouseClickInfo - specifies the mouse button to use and the number of times to click.
      Returns:
      this fixture.
      Throws:
      NullPointerException - if the given MouseClickInfo is null.
      IllegalStateException - if this fixture's JTableHeader is disabled.
      IllegalStateException - if this fixture's JTableHeader is not showing on the screen.
      LocationUnavailableException - if a column with a matching name cannot be found.
    • clickColumn

      public JTableHeaderFixture clickColumn(Pattern columnNamePattern, MouseClickInfo mouseClickInfo)
      Simulates a user clicking the column which name matches the given regular expression pattern, in this fixture's JTableHeader, using the given mouse button, the given number of times.
      Parameters:
      columnNamePattern - the regular expression pattern to match.
      mouseClickInfo - specifies the mouse button to use and the number of times to click.
      Returns:
      this fixture.
      Throws:
      NullPointerException - if the given MouseClickInfo is null.
      IllegalStateException - if this fixture's JTableHeader is disabled.
      IllegalStateException - if this fixture's JTableHeader is not showing on the screen.
      NullPointerException - if the given regular expression pattern is null.
      LocationUnavailableException - if a column with a matching name cannot be found.
      Since:
      1.2
    • validateNotNull

      private void validateNotNull(MouseClickInfo mouseClickInfo)
    • requireToolTip

      public JTableHeaderFixture requireToolTip(String expected)
      Asserts that the toolTip in this fixture's JTableHeader matches the given value.
      Specified by:
      requireToolTip in interface ToolTipDisplayFixture
      Parameters:
      expected - the given value. It can be a regular expression.
      Returns:
      this fixture.
      Throws:
      AssertionError - if the toolTip in this fixture's JTableHeader does not match the given value.
      Since:
      1.2
    • requireToolTip

      public JTableHeaderFixture requireToolTip(Pattern pattern)
      Asserts that the toolTip in this fixture's JTableHeader matches the given regular expression pattern.
      Specified by:
      requireToolTip in interface ToolTipDisplayFixture
      Parameters:
      pattern - the regular expression pattern to match.
      Returns:
      this fixture.
      Throws:
      NullPointerException - if the given regular expression pattern is null.
      AssertionError - if the toolTip in this fixture's JTableHeader does not match the given regular expression.
      Since:
      1.2
    • clientProperty

      public Object clientProperty(Object key)
      Returns the client property stored in this fixture's JTableHeader, under the given key.
      Specified by:
      clientProperty in interface ClientPropertyStorageFixture
      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 is null.
      Since:
      1.2