Search in sources :

Example 1 with EzyPluginSendResponse

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

the class EzySimplePluginContextTest 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();
    EzyPluginSendResponse sendResponse = mock(EzyPluginSendResponse.class);
    doNothing().when(sendResponse).execute(data, recipients, encrypted, EzyTransportType.TCP);
    EzySimplePluginContext sut = new EzySimplePluginContext();
    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 : EzySimplePluginContext(com.tvd12.ezyfoxserver.context.EzySimplePluginContext) EzyData(com.tvd12.ezyfox.entity.EzyData) EzyPluginSendResponse(com.tvd12.ezyfoxserver.command.EzyPluginSendResponse) 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 EzyPluginSendResponse (com.tvd12.ezyfoxserver.command.EzyPluginSendResponse)1 EzySimplePluginContext (com.tvd12.ezyfoxserver.context.EzySimplePluginContext)1 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)1 BaseTest (com.tvd12.test.base.BaseTest)1 Test (org.testng.annotations.Test)1