use of com.tvd12.ezyfoxserver.response.EzySimpleResponse in project ezyfox-server by youngmonkeys.
the class EzySendResponseImplTest method responseOneSuccessCaseTest.
@Test
public void responseOneSuccessCaseTest() {
EzySimpleSettings settings = new EzySimpleSettings();
settings.setDebug(true);
EzyResponseApi responseApi = spy(EzyAbstractResponseApi.class);
EzySimpleServer server = new EzySimpleServer();
server.setResponseApi(responseApi);
server.setSettings(settings);
EzySendResponseImpl cmd = new EzySendResponseImpl(server);
EzyResponse response = new EzySimpleResponse(EzyCommand.APP_REQUEST);
EzySession recipient = spy(EzyAbstractSession.class);
cmd.execute(response, recipient, false, false, EzyTransportType.TCP);
}
use of com.tvd12.ezyfoxserver.response.EzySimpleResponse in project ezyfox-server by youngmonkeys.
the class EzySendResponseImplTest method responseMultiSuccessCaseButNotDebug.
@Test
public void responseMultiSuccessCaseButNotDebug() throws Exception {
// when
EzySimpleSettings settings = new EzySimpleSettings();
settings.setDebug(false);
EzyResponseApi responseApi = mock(EzyResponseApi.class);
EzySimpleServer server = new EzySimpleServer();
server.setResponseApi(responseApi);
server.setSettings(settings);
EzySendResponseImpl cmd = new EzySendResponseImpl(server);
EzyResponse response = new EzySimpleResponse(EzyCommand.APP_REQUEST);
EzySession recipient = spy(EzyAbstractSession.class);
List<EzySession> recipients = Collections.singletonList(recipient);
// when
cmd.execute(response, recipients, false, false, EzyTransportType.TCP);
// then
verify(responseApi, times(1)).response(any(EzyPackage.class), anyBoolean());
}
use of com.tvd12.ezyfoxserver.response.EzySimpleResponse in project ezyfox-server by youngmonkeys.
the class EzySendResponseImplTest method responseMultiErrorTest.
@Test
public void responseMultiErrorTest() throws Exception {
// given
EzySimpleSettings settings = new EzySimpleSettings();
settings.setDebug(true);
EzyResponseApi responseApi = mock(EzyResponseApi.class);
doThrow(new IllegalArgumentException()).when(responseApi).response(any(EzyPackage.class), anyBoolean());
EzySimpleServer server = new EzySimpleServer();
server.setResponseApi(responseApi);
server.setSettings(settings);
EzySendResponseImpl cmd = new EzySendResponseImpl(server);
EzyResponse response = new EzySimpleResponse(EzyCommand.APP_REQUEST);
EzySession recipient = spy(EzyAbstractSession.class);
List<EzySession> recipients = Collections.singletonList(recipient);
// when
cmd.execute(response, recipients, false, false, EzyTransportType.TCP);
// then
verify(responseApi, times(1)).response(any(EzyPackage.class), anyBoolean());
}
Aggregations