spring test 的时候需要测试 facade 接口
@Resourceprivate SmsFacade smsFacade;@Testpublic void sendSmsTiming() {SmsTemplate smsTemplate = newSmsTemplateTiming();Response response = smsFacade.sendSms(smsTemplate);System.out.println(JSON.toJSONString(response));}
结果: smsFacade 为空,抛出 nullpoint 异常
解决:springtest 类上加上如下
@SpringBootTest
@RunWith(SpringRunner.class)