Search in sources :

Example 1 with EzyAppSendResponse

use of com.tvd12.ezyfoxserver.command.EzyAppSendResponse in project ezyfox-server by youngmonkeys.

the class EzySimpleAppContextTest method sendMultiTest.

@Test
public void sendMultiTest() {
    // given
    EzyData data = mock(EzyData.class);
    EzySession recipient = mock(EzySession.class);
    List<EzySession> recipients = Collections.singletonList(recipient);
    boolean encrypted = RandomUtil.randomBoolean();
    EzyAppSendResponse sendResponse = mock(EzyAppSendResponse.class);
    doNothing().when(sendResponse).execute(data, recipients, encrypted, EzyTransportType.TCP);
    EzySimpleAppContext sut = new EzySimpleAppContext();
    FieldUtil.setFieldValue(sut, "sendResponse", sendResponse);
    // when
    sut.send(data, recipients, encrypted, EzyTransportType.TCP);
    // then
    verify(sendResponse, times(1)).execute(data, recipients, encrypted, EzyTransportType.TCP);
}
Also used : EzyAppSendResponse(com.tvd12.ezyfoxserver.command.EzyAppSendResponse) EzyData(com.tvd12.ezyfox.entity.EzyData) EzySimpleAppContext(com.tvd12.ezyfoxserver.context.EzySimpleAppContext) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Aggregations

EzyData (com.tvd12.ezyfox.entity.EzyData)1 EzyAppSendResponse (com.tvd12.ezyfoxserver.command.EzyAppSendResponse)1 EzySimpleAppContext (com.tvd12.ezyfoxserver.context.EzySimpleAppContext)1 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)1 BaseTest (com.tvd12.test.base.BaseTest)1 Test (org.testng.annotations.Test)1