Class JProgressBarDriver

All Implemented Interfaces:
TextDisplayDriver<JProgressBar>

public class JProgressBarDriver extends JComponentDriver implements TextDisplayDriver<JProgressBar>
Understands functional testing of JProgressBars:
  • state verification
  • property value query
This class is intended for internal use only. Please use the classes in the package org.fest.swing.fixture in your tests.
Since:
1.2
  • Field Details

  • Constructor Details

    • JProgressBarDriver

      public JProgressBarDriver(Robot robot)
      Creates a new JProgressBarDriver.
      Parameters:
      robot - the robot to use to simulate user input.
  • Method Details

    • requireText

      @RunsInEDT public void requireText(JProgressBar progressBar, String expected)
      Asserts that the text of the JProgressBar is equal to the specified String.
      Specified by:
      requireText in interface TextDisplayDriver<JProgressBar>
      Parameters:
      progressBar - the target JProgressBar.
      expected - the text to match.
      Throws:
      AssertionError - if the text of the JProgressBar is not equal to the given one.
      See Also:
    • requireText

      @RunsInEDT public void requireText(JProgressBar progressBar, Pattern pattern)
      Asserts that the text of the JProgressBar matches the given regular expression pattern.
      Specified by:
      requireText in interface TextDisplayDriver<JProgressBar>
      Parameters:
      progressBar - the target JProgressBar.
      pattern - the regular expression pattern to match.
      Throws:
      AssertionError - if the text of the JProgressBar does not match the given regular expression pattern.
      NullPointerException - if the given regular expression pattern is null.
      See Also:
    • requireValue

      @RunsInEDT public void requireValue(JProgressBar progressBar, int value)
      Verifies that the value of the given JProgressBar is equal to the given one.
      Parameters:
      progressBar - the target JProgressBar.
      value - the expected value.
      Throws:
      AssertionError - if the value of the JProgressBar is not equal to the given one.
    • requireIndeterminate

      @RunsInEDT public void requireIndeterminate(JProgressBar progressBar)
      Verifies that the given JProgressBar is in indeterminate mode.
      Parameters:
      progressBar - the target JProgressBar.
      Throws:
      AssertionError - if the given JProgressBar is not in indeterminate mode.
    • requireDeterminate

      @RunsInEDT public void requireDeterminate(JProgressBar progressBar)
      Verifies that the given JProgressBar is in determinate mode.
      Parameters:
      progressBar - the target JProgressBar.
      Throws:
      AssertionError - if the given JProgressBar is not in determinate mode.
    • requireIndeterminate

      @RunsInEDT private void requireIndeterminate(JProgressBar progressBar, boolean indeterminate)
    • waitUntilValueIs

      @RunsInEDT public void waitUntilValueIs(JProgressBar progressBar, int value)
      Waits until the value of the given JProgressBar is equal to the given value.
      Parameters:
      progressBar - the target JProgressBar.
      value - the expected value.
      Throws:
      IllegalArgumentException - if the given value is less than the JProgressBar's minimum value.
      IllegalArgumentException - if the given value is greater than the JProgressBar's maximum value.
      WaitTimedOutError - if the value of the JProgressBar does not reach the expected value within 30 seconds.
    • waitUntilValueIs

      @RunsInEDT public void waitUntilValueIs(JProgressBar progressBar, int value, Timeout timeout)
      Waits until the value of the given JProgressBar is equal to the given value.
      Parameters:
      progressBar - the target JProgressBar.
      value - the expected value.
      timeout - the amount of time to wait.
      Throws:
      IllegalArgumentException - if the given value is less than the JProgressBar's minimum value.
      IllegalArgumentException - if the given value is greater than the JProgressBar's maximum value.
      NullPointerException - if the given timeout is null.
      WaitTimedOutError - if the value of the JProgressBar does not reach the expected value within the specified timeout.
    • assertIsInBetweenMinAndMax

      @RunsInEDT private void assertIsInBetweenMinAndMax(JProgressBar progressBar, int value)
    • assertIsInBetweenMinAndMax

      private void assertIsInBetweenMinAndMax(int value, int min, int max)
    • waitUntilIsDeterminate

      @RunsInEDT public void waitUntilIsDeterminate(JProgressBar progressBar)
      Waits until the value of the given JProgressBar is in determinate mode.
      Parameters:
      progressBar - the target JProgressBar.
      Throws:
      WaitTimedOutError - if the JProgressBar does not reach determinate mode within 30 seconds.
    • waitUntilIsDeterminate

      @RunsInEDT public void waitUntilIsDeterminate(JProgressBar progressBar, Timeout timeout)
      Waits until the value of the given JProgressBar is in determinate mode.
      Parameters:
      progressBar - the target JProgressBar.
      timeout - the amount of time to wait.
      Throws:
      NullPointerException - if the given timeout is null.
      WaitTimedOutError - if the JProgressBar does not reach determinate mode within the specified timeout.
    • validateIsNotNull

      private void validateIsNotNull(Timeout timeout)
    • textOf

      @RunsInEDT public String textOf(JProgressBar progressBar)
      Returns the text of the given JProgressBar.
      Specified by:
      textOf in interface TextDisplayDriver<JProgressBar>
      Parameters:
      progressBar - the target JProgressBar.
      Returns:
      the text of the given JProgressBar.