T
- The type of mock object providedpublic class AsyncMockProvider<T> extends Object implements AsyncProvider<T>
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.Constructor and Description |
---|
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. |
public AsyncMockProvider(T mock)
AsyncProvider
that will provide the mock object.mock
- The mock object to provide.public AsyncMockProvider(Throwable error)
AsyncProvider
that will fail to provide the mock
object, and will fail with the specified error.error
- The error to fail with, a Throwable
.public void get(AsyncCallback<? super T> callback)
get
in interface AsyncProvider<T>
Copyright © 2010–2014 Arcbees. All rights reserved.