@Override
    public SmsSendRespDTO sendSms(Long sendLogId, String mobile,
                                  String apiTemplateId, List<KeyValue<String, Object>> templateParams) throws Throwable {
        // 构建请求
        SendSmsRequest request = new SendSmsRequest();
        request.setSmsSdkAppId(getSdkAppId());
        request.setPhoneNumberSet(new String[]{mobile});
        request.setSignName(properties.getSignature());
        request.setTemplateId(apiTemplateId);
        request.setTemplateParamSet(ArrayUtils.toArray(templateParams, e -> String.valueOf(e.getValue())));
        request.setSessionContext(JsonUtils.toJsonString(new SessionContext().setLogId(sendLogId)));
        // 执行请求
        SendSmsResponse response = client.SendSms(request);
        SendStatus status = response.getSendStatusSet()[0];
        return new SmsSendRespDTO().setSuccess(Objects.equals(status.getCode(), API_CODE_SUCCESS)).setSerialNo(status.getSerialNo())
                .setApiRequestId(response.getRequestId()).setApiCode(status.getCode()).setApiMsg(status.getMessage());
    }
@Test
    public void testDoSendSms_fail() throws Throwable {
        // 准备参数
        Long sendLogId = randomLongId();
        String mobile = randomString();
        String apiTemplateId = randomString();
        List<KeyValue<String, Object>> templateParams = Lists.newArrayList(
                new KeyValue<>("1", 1234), new KeyValue<>("2", "login"));
        String requestId = randomString();
        String serialNo = randomString();
        // mock 方法
        SendSmsResponse response = randomPojo(SendSmsResponse.class, o -> {
            o.setRequestId(requestId);
            SendStatus[] sendStatuses = new SendStatus[1];
            o.setSendStatusSet(sendStatuses);
            SendStatus sendStatus = new SendStatus();
            sendStatuses[0] = sendStatus;
            sendStatus.setCode("ERROR");
            sendStatus.setMessage("send success");
            sendStatus.setSerialNo(serialNo);
        });
        when(client.SendSms(argThat(request -> {
            assertEquals(mobile, request.getPhoneNumberSet()[0]);
            assertEquals(properties.getSignature(), request.getSignName());
            assertEquals(apiTemplateId, request.getTemplateId());
            assertEquals(toJsonString(ArrayUtils.toArray(new ArrayList<>(MapUtils.convertMap(templateParams).values()), String::valueOf)),
                    toJsonString(request.getTemplateParamSet()));
            assertEquals(sendLogId, ReflectUtil.getFieldValue(JsonUtils.parseObject(request.getSessionContext(), TencentSmsClient.SessionContext.class), "logId"));
            return true;
        }))).thenReturn(response);

        // 调用
        SmsSendRespDTO result = smsClient.sendSms(sendLogId, mobile, apiTemplateId, templateParams);
        // 断言
        assertFalse(result.getSuccess());
        assertEquals(response.getRequestId(), result.getApiRequestId());
        assertEquals(response.getSendStatusSet()[0].getCode(), result.getApiCode());
        assertEquals(response.getSendStatusSet()[0].getMessage(), result.getApiMsg());
        assertEquals(response.getSendStatusSet()[0].getSerialNo(), result.getSerialNo());
    }