Interface TextDisplayDriver<T extends Component>

Type Parameters:
T - the type of Component this driver supports.
All Known Implementing Classes:
AbstractButtonDriver, JLabelDriver, JProgressBarDriver, JTextComponentDriver

public interface TextDisplayDriver<T extends Component>
Understands functional testing of a Component that displays text.
Since:
1.2
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    requireText(T component, String expected)
    Asserts that the text in the given component is equal to or matches the specified String.
    void
    requireText(T component, Pattern pattern)
    Asserts that the text in the given component matches the given regular expression pattern.
    textOf(T component)
    Returns the text of the given component.
  • Method Details

    • requireText

      void requireText(T component, String expected)
      Asserts that the text in the given component is equal to or matches the specified String.
      Parameters:
      component - the given component.
      expected - the text to match. It can be a regular expression.
      Throws:
      AssertionError - if the text of the component is not equal to or does not match the given one.
    • requireText

      void requireText(T component, Pattern pattern)
      Asserts that the text in the given component matches the given regular expression pattern.
      Parameters:
      component - the given component.
      pattern - the regular expression pattern to match.
      Throws:
      NullPointerException - if the given regular expression pattern is null.
      AssertionError - if the text of the component does not match the given regular expression pattern.
      Since:
      1.2
    • textOf

      String textOf(T component)
      Returns the text of the given component.
      Parameters:
      component - the given component.
      Returns:
      the text of the given component.