com.gwtplatform.tester
Class AsyncMockProvider<T>

java.lang.Object
  extended by com.gwtplatform.tester.AsyncMockProvider<T>
Type Parameters:
T - The type of mock object provided
All Implemented Interfaces:
AsyncProvider<T>

public class AsyncMockProvider<T>
extends Object
implements AsyncProvider<T>

For use in test cases where an AsyncProvider is required to provide an object and the test case needs to provide a mock of the object.

Note that the same mock will be returned for every invocation of of get(AsyncCallback) (it behaves as a singleton) which may impact your tests, for example if you rely on ==. If you're using mockito, consider using the AsyncMockProvider instead.

Author:
Brendan Doherty

Constructor Summary
AsyncMockProvider(T mock)
          Construct a AsyncProvider that will provide the mock object.
AsyncMockProvider(Throwable error)
          Construct a AsyncProvider that will fail to provide the mock object, and will fail with the specified error.
 
Method Summary
 void get(AsyncCallback<T> callback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncMockProvider

public AsyncMockProvider(T mock)
Construct a AsyncProvider that will provide the mock object.

Parameters:
mock - The mock object to provide.

AsyncMockProvider

public AsyncMockProvider(Throwable error)
Construct a AsyncProvider that will fail to provide the mock object, and will fail with the specified error.

Parameters:
error - The error to fail with, a Throwable.
Method Detail

get

public void get(AsyncCallback<T> callback)
Specified by:
get in interface AsyncProvider<T>


Copyright © 2010-2011 ArcBees. All Rights Reserved.