SmsYunPianClient implements SmsClient { @Override public SendResult singleSend(String mobile, String sign, String templateCode, String template, Map<String, String> templateParams) { template = buildTemplate(sign, template, templateParams); Map<String, String> params = new LinkedHashMap<>(); params.put("apikey", apiKey); params.put("mobile", mobile); params.put("text", template); String result = post(URL_SEND_SINGLE, params); JSONObject jsonObject = JSON.parseObject(result); if (jsonObject.containsKey("code") && !(jsonObject.getInteger("code") == SUCCESS_CODE)) { throw new ServiceException(AdminErrorCodeEnum.SMS_PLATFORM_FAIL.getCode(), jsonObject.getString("detail")); } return new SendResult() .setIsSuccess(SUCCESS_CODE == jsonObject.getInteger("code")) .setCode(jsonObject.getInteger("code")) .setMessage(jsonObject.getString("detail")); }  @Override SendResult singleSend(String mobile, String sign, String templateCode, String template, Map<String, String> templateParams); @Override SendResult batchSend(List<String> mobileList, String sign,
                                String templateCode, String template,
                                Map<String, String> templateParams); static String post(String url, Map<String, String> paramsMap);  }
@Test public void sendMobileTest() { String mobile = "13302926050"; String template = "您的验证码是#code#，打死也不告诉别人哦。"; smsYunPianClient.singleSend(mobile, sign, null, template, ImmutableMap.of("code", "1111")); }