Java Code Examples for org.easymock.EasyMock#capture()
The following examples show how to use
org.easymock.EasyMock#capture() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterPingerTest.java From mongodb-async-driver with Apache License 2.0 | 6 votes |
/** * Creates a new CallbackReply. * * @param builder * The reply to provide to the callback. * @return The CallbackReply. */ private ReplyCallback cbAndCloseWithConn(final DocumentBuilder builder) { class CloseCallbackWithSetConnection extends CloseCallbackReply { private static final long serialVersionUID = -2458416861114720698L; public CloseCallbackWithSetConnection(final Reply reply) { super(reply); } @Override public void setValue(final Callback<Reply> value) { super.setValue(value); } } EasyMock.capture(new CloseCallbackWithSetConnection(CallbackReply .reply(builder))); return null; }
Example 2
Source File: ClusterPingerTest.java From mongodb-async-driver with Apache License 2.0 | 6 votes |
/** * Creates a new CallbackReply. * * @param builder * The reply to provide to the callback. * @return The CallbackReply. */ private ReplyCallback cbWithConn(final DocumentBuilder builder) { class CallbackWithSetConnection extends CallbackCapture<Reply> { private static final long serialVersionUID = -2458416861114720698L; public CallbackWithSetConnection(final Reply reply) { super(reply); } @Override public void setValue(final Callback<Reply> value) { super.setValue(value); } } EasyMock.capture(new CallbackWithSetConnection(CallbackReply .reply(builder))); return null; }
Example 3
Source File: ClusterPingerTest.java From mongodb-async-driver with Apache License 2.0 | 2 votes |
/** * Creates a new CallbackReply. * * @param reply * The reply to provide to the callback. * @return The CallbackReply. */ protected ReplyCallback cbAndClose(final Reply reply) { EasyMock.capture(new CloseCallbackReply(reply)); return null; }
Example 4
Source File: ClusterPingerTest.java From mongodb-async-driver with Apache License 2.0 | 2 votes |
/** * Creates a new CallbackReply. * * @param error * The error to provide to the callback. * @return The CallbackReply. */ protected ReplyCallback cbAndClose(final Throwable error) { EasyMock.capture(new CloseCallbackReply(error)); return null; }
Example 5
Source File: ClusterPingerTest.java From mongodb-async-driver with Apache License 2.0 | 2 votes |
/** * Creates a new CallbackReply. * * @return The CallbackReply. */ protected ReplyCallback cbAndCloseError() { EasyMock.capture(new CloseCallbackReply(new Throwable("Injected -3"))); return null; }
Example 6
Source File: CallbackCapture.java From mongodb-async-driver with Apache License 2.0 | 2 votes |
/** * Creates a new CallbackCapture. * * @param <T> * The type for the callback. * @param value * The value to provide to the callback. * @return The CallbackCapture. */ public static <T> Callback<T> callback(final T value) { EasyMock.capture(new CallbackCapture<T>(value)); return null; }
Example 7
Source File: CallbackCapture.java From mongodb-async-driver with Apache License 2.0 | 2 votes |
/** * Creates a new CallbackCapture. * * @param <T> * The type for the callback. * @param error * The error to provide to the callback. * @return The CallbackCapture. */ public static <T> Callback<T> callback(final Throwable error) { EasyMock.capture(new CallbackCapture<T>(error)); return null; }
Example 8
Source File: CallbackCapture.java From mongodb-async-driver with Apache License 2.0 | 2 votes |
/** * Creates a new CallbackCapture. * * @param <T> * The type for the callback. * @return The CallbackCapture. */ public static <T> Callback<T> callbackError() { EasyMock.capture(new CallbackCapture<T>(new Throwable("Injected"))); return null; }