org.fest.swing.fixture
Class JProgressBarFixture

java.lang.Object
  extended by org.fest.swing.fixture.ComponentFixture<JProgressBar>
      extended by org.fest.swing.fixture.JProgressBarFixture
All Implemented Interfaces:
ClientPropertyStorageFixture, JComponentFixture, StateVerificationFixture, TextDisplayFixture, ToolTipDisplayFixture

public class JProgressBarFixture
extends ComponentFixture<JProgressBar>
implements StateVerificationFixture, JComponentFixture, TextDisplayFixture

Understands functional testing of JProgressBars:

Since:
1.2
Author:
Alex Ruiz

Field Summary
 
Fields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
 
Constructor Summary
JProgressBarFixture(Robot robot, JProgressBar target)
          Creates a new JProgressBarFixture.
JProgressBarFixture(Robot robot, String labelName)
          Creates a new JProgressBarFixture.
 
Method Summary
 Object clientProperty(Object key)
          Returns the client property stored in this fixture's JProgressBar, under the given key.
protected  void driver(JProgressBarDriver newDriver)
          Sets the JProgressBarDriver to be used by this fixture.
 JProgressBarFixture requireDeterminate()
          Asserts that this fixture's JProgressBar is in determinate mode.
 JProgressBarFixture requireDisabled()
          Asserts that this fixture's JProgressBar is disabled.
 JProgressBarFixture requireEnabled()
          Asserts that this fixture's JProgressBar is enabled.
 JProgressBarFixture requireEnabled(Timeout timeout)
          Asserts that this fixture's JProgressBar is enabled.
 JProgressBarFixture requireIndeterminate()
          Asserts that this fixture's JProgressBar is in indeterminate mode.
 JProgressBarFixture requireNotVisible()
          Asserts that this fixture's JProgressBar is not visible.
 JProgressBarFixture requireText(Pattern pattern)
          Asserts that the text of this fixture's JProgressBar matches the given regular expression pattern.
 JProgressBarFixture requireText(String expected)
          Asserts that the text of this fixture's JProgressBar is equal to the specified String.
 JProgressBarFixture requireToolTip(Pattern pattern)
          Asserts that the toolTip in this fixture's JProgressBar matches the given regular expression pattern.
 JProgressBarFixture requireToolTip(String expected)
          Asserts that the toolTip in this fixture's JProgressBar matches the given value.
 JProgressBarFixture requireValue(int value)
          Asserts that the value of this fixture's JProgressBar is equal to the given one.
 JProgressBarFixture requireVisible()
          Asserts that this fixture's JProgressBar is visible.
 String text()
          Returns the text of this fixture's JProgressBar.
 JProgressBarFixture waitUntilIsDeterminate()
          Waits until the value of this fixture's JProgressBar is in determinate mode.
 JProgressBarFixture waitUntilIsDeterminate(Timeout timeout)
          Waits until the value of this fixture's JProgressBar is in determinate mode.
 JProgressBarFixture waitUntilValueIs(int value)
          Waits until the value of this fixture's JProgressBar is equal to the given value.
 JProgressBarFixture waitUntilValueIs(int value, Timeout timeout)
          Waits until the value of this fixture's JProgressBar is equal to the given value.
 
Methods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JProgressBarFixture

public JProgressBarFixture(Robot robot,
                           JProgressBar target)
Creates a new JProgressBarFixture.

Parameters:
robot - performs simulation of user events on the given JProgressBar.
target - the JProgressBar to be managed by this fixture.
Throws:
NullPointerException - if robot is null.
NullPointerException - if target is null.

JProgressBarFixture

public JProgressBarFixture(Robot robot,
                           String labelName)
Creates a new JProgressBarFixture.

Parameters:
robot - performs simulation of user events on a JProgressBar.
labelName - the name of the JProgressBar to find using the given Robot.
Throws:
NullPointerException - if robot is null.
ComponentLookupException - if a matching JProgressBar could not be found.
ComponentLookupException - if more than one matching JProgressBar is found.
Method Detail

driver

protected final void driver(JProgressBarDriver newDriver)
Sets the JProgressBarDriver to be used by this fixture.

Parameters:
newDriver - the new JProgressBarDriver.
Throws:
NullPointerException - if the given driver is null.

requireValue

public JProgressBarFixture requireValue(int value)
Asserts that the value of this fixture's JProgressBar is equal to the given one.

Parameters:
value - the expected value.
Returns:
this fixture.
Throws:
AssertionError - if the value of this fixture's JProgressBar is not equal to the given one.

requireDeterminate

public JProgressBarFixture requireDeterminate()
Asserts that this fixture's JProgressBar is in determinate mode.

Returns:
this fixture.
Throws:
AssertionError - if this fixture's JProgressBar is not in determinate mode.

requireIndeterminate

public JProgressBarFixture requireIndeterminate()
Asserts that this fixture's JProgressBar is in indeterminate mode.

Returns:
this fixture.
Throws:
AssertionError - if this fixture's JProgressBar is not in indeterminate mode.

text

public String text()
Returns the text of this fixture's JProgressBar.

Specified by:
text in interface TextDisplayFixture
Returns:
the text of this fixture's JProgressBar.

requireText

public JProgressBarFixture requireText(String expected)
Asserts that the text of this fixture's JProgressBar is equal to the specified String.

Specified by:
requireText in interface TextDisplayFixture
Parameters:
expected - the text to match.
Returns:
this fixture.
Throws:
AssertionError - if the text of this fixture's JProgressBar is not equal to the given one.

requireText

public JProgressBarFixture requireText(Pattern pattern)
Asserts that the text of this fixture's JProgressBar matches the given regular expression pattern.

Specified by:
requireText in interface TextDisplayFixture
Parameters:
pattern - the regular expression pattern to match.
Returns:
this fixture.
Throws:
AssertionError - if the text of this fixture's JProgressBar does not match the given regular expression pattern.
NullPointerException - if the given regular expression pattern is null.

requireToolTip

public JProgressBarFixture requireToolTip(String expected)
Asserts that the toolTip in this fixture's JProgressBar 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 JProgressBar does not match the given value.

requireToolTip

public JProgressBarFixture requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's JProgressBar 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 JProgressBar does not match the given regular expression pattern.

requireEnabled

public JProgressBarFixture requireEnabled()
Asserts that this fixture's JProgressBar is enabled.

Specified by:
requireEnabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JProgressBar is disabled.

requireEnabled

public JProgressBarFixture requireEnabled(Timeout timeout)
Asserts that this fixture's JProgressBar is enabled.

Specified by:
requireEnabled in interface StateVerificationFixture
Parameters:
timeout - the time this fixture will wait for the component to be enabled.
Returns:
this fixture.
Throws:
WaitTimedOutError - if this fixture's JProgressBar is never enabled.

requireDisabled

public JProgressBarFixture requireDisabled()
Asserts that this fixture's JProgressBar is disabled.

Specified by:
requireDisabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JProgressBar is enabled.

requireVisible

public JProgressBarFixture requireVisible()
Asserts that this fixture's JProgressBar is visible.

Specified by:
requireVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JProgressBar is not visible.

requireNotVisible

public JProgressBarFixture requireNotVisible()
Asserts that this fixture's JProgressBar is not visible.

Specified by:
requireNotVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JProgressBar is visible.

clientProperty

public Object clientProperty(Object key)
Returns the client property stored in this fixture's JProgressBar, 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.

waitUntilValueIs

public JProgressBarFixture waitUntilValueIs(int value)
Waits until the value of this fixture's JProgressBar is equal to the given value.

Parameters:
value - the expected value.
Returns:
this fixture.
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

public JProgressBarFixture waitUntilValueIs(int value,
                                            Timeout timeout)
Waits until the value of this fixture's JProgressBar is equal to the given value.

Parameters:
value - the expected value.
timeout - the amount of time to wait.
Returns:
this fixture.
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.

waitUntilIsDeterminate

public JProgressBarFixture waitUntilIsDeterminate()
Waits until the value of this fixture's JProgressBar is in determinate mode.

Returns:
this fixture.
Throws:
WaitTimedOutError - if the JProgressBar does not reach determinate mode within 30 seconds.

waitUntilIsDeterminate

public JProgressBarFixture waitUntilIsDeterminate(Timeout timeout)
Waits until the value of this fixture's JProgressBar is in determinate mode.

Parameters:
timeout - the amount of time to wait.
Returns:
this fixture.
Throws:
NullPointerException - if the given timeout is null.
WaitTimedOutError - if the JProgressBar does not reach determinate mode within the specified timeout.


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