API Documentation | All Packages | All Classes | Index | Frames No Frames |
AsyncLocator

Package | org.flexunit.async
Class | public class AsyncLocator
Inheritance | AsyncLocator Object

The `AsyncLocator` is used to keep track of test cases that have implemented asynchronous functionality. The test cases are registered with the `AsyncLocator` and reference an object that implements `IAsyncHandlingStatement`. Test cases are registered using the method `#registerStatementForTest()`. The `IAsyncHandlingStatement` is then retrieved using the method `#getCallableForTest()` and providing the test case. If a test case has not been registered, an `AssertionError` will be thrown. Once an asynchronous test has completed, the method `#cleanUpCallableForTest` should be called in order to disassociate the test case and the `IAsyncHandlingStatement`.

See also

org.flexunit.async.Async

Public Methods

| Method | Defined By
--- | --- | ---
|  | cleanUpCallableForTest(testCase:Object):void [static] Removes the registration for the IAsyncHandlingStatement that was associated with the provided testCase. | AsyncLocator
|  | getCallableForTest(testCase:Object):IAsyncHandlingStatement [static] Retrieves the IAsyncHandlingStatement for the provided testCase. | AsyncLocator
|  | hasCallableForTest(testCase:Object):Boolean [static] | AsyncLocator
|  | registerStatementForTest(expectAsyncInstance:IAsyncHandlingStatement, testCase:Object):void [static] Registers the expectAsyncInstance with the provided testCase. | AsyncLocator

Method Detail

cleanUpCallableForTest | () | method

`public static function cleanUpCallableForTest(testCase:Object):void`

Removes the registration for the `IAsyncHandlingStatement` that was associated with the provided `testCase`.

Parameters

| `testCase:Object` — The test case to remove the association with the `IAsyncHandlingStatement`.

getCallableForTest | () | method |

`public static function getCallableForTest(testCase:Object):IAsyncHandlingStatement`

Retrieves the `IAsyncHandlingStatement` for the provided `testCase`. If no `IAsyncHandlingStatement` has been registered for the `testCase`, an `AssertionError` will be thrown.

Parameters

| `testCase:Object` — The test case used to retrieve the `IAsyncHandlingStatement`.

Returns

| `IAsyncHandlingStatement` — an `IAsyncHandlingStatement` associated with the `testCase`.

Throws

| `AssertionError` — Thrown if an `IAsyncHandlingStatement` was not registered for the provided `testCase`.

hasCallableForTest | () | method |

`public static function hasCallableForTest(testCase:Object):Boolean`

Parameters

| `testCase:Object`

Returns

| `Boolean`

registerStatementForTest | () | method |

`public static function registerStatementForTest(expectAsyncInstance:IAsyncHandlingStatement, testCase:Object):void`

Registers the `expectAsyncInstance` with the provided `testCase`.

Parameters

| `expectAsyncInstance:IAsyncHandlingStatement` — the `IAsyncHandlingStatement` to be registered.
| `testCase:Object` — The test case to associate with the particular `expectAsyncInstance`.

Thu Apr 10 2014, 08:07 AM +10:00