1 package com.github.triceo.splitlog.api;
2
3 import java.util.concurrent.Future;
4
5 interface SupportsExpectations<S extends MessageProducer<S>, C> {
6
7 /**
8 * Will return a future that will only return when a message arrives that
9 * makes the given condition return true.
10 *
11 * @param condition
12 * Condition that needs to be true for the future to unblock.
13 * @return Null if the method unblocked due to some other reason.
14 */
15 Future<Message> expect(C condition);
16
17 /**
18 * Will return a future that will only return when a message arrives that
19 * makes the given condition return true, at which point it asynchronously
20 * executes a particular action. It will not return until that action has
21 * finished executing.
22 *
23 * @param condition
24 * Condition that needs to be true for the future to unblock.
25 * @param action
26 * Action to execute when the condition becomes true.
27 * @return Null if the method unblocked due to some other reason.
28 */
29 Future<Message> expect(C condition, MessageAction<S> action);
30
31 }