Package org.yamcs.tests
Class MessageCaptor<T extends com.google.protobuf.Message>
java.lang.Object
org.yamcs.tests.MessageCaptor<T>
Utility class for queueing original messages as they are received from a subscription to Yamcs. This is intended for
use in unit tests only.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
int
Returns the number of unprocessed messages.boolean
isEmpty()
Returns true if there are not currently any unprocessed messages.static <T extends com.google.protobuf.Message>
MessageCaptor<T>of
(Subscription<?, T> subscription) poll()
Returns the next received message.poll
(long timeout)
-
Method Details
-
poll
Returns the next received message. Or null, if nothing was received yet. -
poll
- Throws:
InterruptedException
-
expectTimely
- Throws:
InterruptedException
TimeoutException
-
clear
public void clear() -
isEmpty
public boolean isEmpty()Returns true if there are not currently any unprocessed messages. -
getPendingCount
public int getPendingCount()Returns the number of unprocessed messages. -
of
public static <T extends com.google.protobuf.Message> MessageCaptor<T> of(Subscription<?, T> subscription)
-