### Question:
MailController { @PostMapping(path = "/send") public BaseResponse send(@RequestBody @Valid EmailRequest request) { mailSendService.sendMailAsync(request); return BaseResponse.builder().message("email has been sent async.").build(); }  @PostMapping(path = "/send") BaseResponse send(@RequestBody @Valid EmailRequest request);  }### Answer:
@Test public void testSendMail() throws ClientException { SingleSendMailResponse singleSendMailResponse = new SingleSendMailResponse(); singleSendMailResponse.setRequestId("mock_id"); when(iAcsClient.getAcsResponse(any(SingleSendMailRequest.class))).thenReturn(singleSendMailResponse); String email = "test@jskillcloud.com"; String name = "test_user"; String subject = "test_subject"; String htmlBody = "test html body..."; EmailRequest emailRequest = EmailRequest.builder() .to(email) .name(name) .subject(subject) .htmlBody(htmlBody) .build(); BaseResponse baseResponse = mailClient.send(emailRequest); log.info(baseResponse.toString()); assertThat(baseResponse.isSuccess()).isTrue(); ArgumentCaptor<SingleSendMailRequest> argument = ArgumentCaptor.forClass(SingleSendMailRequest.class); verify(iAcsClient, times(1)).getAcsResponse(argument.capture()); SingleSendMailRequest singleSendMailRequest = argument.getValue(); assertThat(singleSendMailRequest.getAccountName()).isEqualTo(MailConstant.FROM); assertThat(singleSendMailRequest.getFromAlias()).isEqualTo(MailConstant.FROM_NAME); assertThat(singleSendMailRequest.getAddressType()).isEqualTo(1); assertThat(singleSendMailRequest.getToAddress()).isEqualTo(emailRequest.getTo()); assertThat(singleSendMailRequest.getReplyToAddress()).isEqualTo(false); assertThat(singleSendMailRequest.getSubject()).endsWith(emailRequest.getSubject()); assertThat(singleSendMailRequest.getHtmlBody()).isEqualTo(emailRequest.getHtmlBody()); when(iAcsClient.getAcsResponse(any(SingleSendMailRequest.class))).thenThrow(new ClientException("aliyun fail")); baseResponse = mailClient.send(emailRequest); log.info(baseResponse.toString()); assertThat(baseResponse.isSuccess()).isTrue(); }