org.fest.swing.lock
Class ScreenLock

java.lang.Object
  extended by org.fest.swing.lock.ScreenLock

@ThreadSafe
public final class ScreenLock
extends Object

Understands a lock that each GUI test should acquire before being executed, to guarantee sequential execution of GUI tests and to prevent GUI tests from blocking each other.

Author:
Yvonne Wang, Alex Ruiz

Method Summary
 void acquire(Object newOwner)
          Acquires this lock.
 boolean acquired()
          Indicates whether this lock is already acquired.
 boolean acquiredBy(Object possibleOwner)
          Indicates whether this lock was acquired by the given object.
static ScreenLock instance()
          Returns the singleton instance of this class.
 void release(Object currentOwner)
          Releases this lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

acquire

public void acquire(Object newOwner)
Acquires this lock. If this lock was already acquired by another object, this method will block until the lock is released.

Parameters:
newOwner - the new owner of the lock.

release

public void release(Object currentOwner)
Releases this lock.

Parameters:
currentOwner - the current owner of the lock.
Throws:
ScreenLockException - if the lock has not been previously acquired.
ScreenLockException - if the given owner is not the same as the current owner of the lock.

acquiredBy

public boolean acquiredBy(Object possibleOwner)
Indicates whether this lock was acquired by the given object.

Parameters:
possibleOwner - the given object, which could be owning the lock.
Returns:
true if the given object is owning the lock; false otherwise.

acquired

public boolean acquired()
Indicates whether this lock is already acquired.

Returns:
true if the lock is already acquired; false otherwise.
Since:
1.2
See Also:
acquiredBy(Object)

instance

public static ScreenLock instance()
Returns the singleton instance of this class.

Returns:
the singleton instance of this class.


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