Search in sources :

Example 1 with GetEmailStatusResponse

use of com.ctrip.soa.platform.basesystem.emailservice.v1.GetEmailStatusResponse in project x-pipe by ctripcorp.

the class AsyncSendEmailCommandTest method testAsyncSendEmailCommand3.

@Test
public void testAsyncSendEmailCommand3() throws Exception {
    SendEmailResponse response = new SendEmailResponse();
    response.setResultCode(1);
    when(client.sendEmail(any())).thenReturn(response);
    GetEmailStatusResponse getResponse = new GetEmailStatusResponse();
    getResponse.setResultCode(0);
    getResponse.setResultMsg("test exception result could be caught");
    when(client.getEmailStatus(any())).thenReturn(getResponse);
    CtripPlatformEmailService.AsyncSendEmailCommand command = new CtripPlatformEmailService.AsyncSendEmailCommand(generateEmail());
    command.setClient(client);
    CommandFuture future = command.execute();
    future.addListener(commandFuture -> {
        Assert.assertFalse(future.isSuccess());
        Assert.assertEquals("test exception result could be caught", future.cause().getMessage());
    });
    waitConditionUntilTimeOut(() -> future.isDone(), 10 * 1000);
}
Also used : SendEmailResponse(com.ctrip.soa.platform.basesystem.emailservice.v1.SendEmailResponse) GetEmailStatusResponse(com.ctrip.soa.platform.basesystem.emailservice.v1.GetEmailStatusResponse) CommandFuture(com.ctrip.xpipe.api.command.CommandFuture) Test(org.junit.Test) AbstractTest(com.ctrip.xpipe.AbstractTest)

Example 2 with GetEmailStatusResponse

use of com.ctrip.soa.platform.basesystem.emailservice.v1.GetEmailStatusResponse in project x-pipe by ctripcorp.

the class AsyncSendEmailCommandTest method testAsyncSendEmailCommand2.

@Test
public void testAsyncSendEmailCommand2() throws Exception {
    SendEmailResponse response = new SendEmailResponse();
    response.setResultCode(1);
    when(client.sendEmail(any())).thenReturn(response);
    GetEmailStatusResponse getResponse = new GetEmailStatusResponse();
    getResponse.setResultCode(1);
    when(client.getEmailStatus(any())).thenReturn(getResponse);
    CtripPlatformEmailService.AsyncSendEmailCommand command = new CtripPlatformEmailService.AsyncSendEmailCommand(generateEmail());
    command.setClient(client);
    CommandFuture future = command.execute();
    Assert.assertTrue(future.isSuccess());
}
Also used : SendEmailResponse(com.ctrip.soa.platform.basesystem.emailservice.v1.SendEmailResponse) GetEmailStatusResponse(com.ctrip.soa.platform.basesystem.emailservice.v1.GetEmailStatusResponse) CommandFuture(com.ctrip.xpipe.api.command.CommandFuture) Test(org.junit.Test) AbstractTest(com.ctrip.xpipe.AbstractTest)

Aggregations

GetEmailStatusResponse (com.ctrip.soa.platform.basesystem.emailservice.v1.GetEmailStatusResponse)2 SendEmailResponse (com.ctrip.soa.platform.basesystem.emailservice.v1.SendEmailResponse)2 AbstractTest (com.ctrip.xpipe.AbstractTest)2 CommandFuture (com.ctrip.xpipe.api.command.CommandFuture)2 Test (org.junit.Test)2