/**
* Test of sendMessageToClient method, of class CallServiceManager.
*/
@Test
public void testSendMessageToClient() {
System.out.println("sendMessageToClient");
Session client = mock(Session.class);
MessageToClient mtc = mock(MessageToClient.class);
RemoteEndpoint.Async async = mock(RemoteEndpoint.Async.class);
when(client.getAsyncRemote()).thenReturn(async);
when(messageToClientService.createMessageToClient(any(MessageFromClient.class), any(Session.class))).thenReturn(mtc).thenReturn(null);
boolean result = instance.sendMessageToClient(new MessageFromClient(), client);
assertThat(result).isTrue();
result = instance.sendMessageToClient(new MessageFromClient(), client);
assertThat(result).isFalse();
ArgumentCaptor<MessageToClient> captureMsg = ArgumentCaptor.forClass(MessageToClient.class);
verify(async).sendObject(captureMsg.capture());
assertThat(captureMsg.getValue()).isEqualTo(mtc);
}
CallServiceManagerTest.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:ocelot
作者:
评论列表
文章目录