use of com.github.dedis.popstellar.model.network.method.Message in project popstellar by dedis.
the class ConnectionTest method sendMessageDelegatesToService.
@Test
public void sendMessageDelegatesToService() {
LAOService service = mock(LAOService.class);
BehaviorSubject<GenericMessage> messages = BehaviorSubject.create();
when(service.observeMessage()).thenReturn(messages);
BehaviorSubject<Lifecycle.State> manualState = BehaviorSubject.create();
Connection connection = new Connection(service, manualState);
Message msg = new Subscribe(Channel.ROOT, 12);
connection.sendMessage(msg);
verify(service).sendMessage(msg);
verify(service).observeMessage();
verifyNoMoreInteractions(service);
}
Aggregations