【发布时间】:2019-09-02 11:04:06
【问题描述】:
我想创建 JUnit 测试来检查来自 SendGrid 的邮件。
我有 A 类,我有方法 send 有发送邮件的实现。:
public void send(Mail mail, String sendGridKey) throws IOException {
SendGrid sg = new SendGrid(sendGridKey);
Request request = new Request();
try {
request.setMethod(Method.POST);
request.setEndpoint("mail/send");
request.setBody(mail.build());
Response response = sg.api(request);
} catch (IOException ex) {
throw ex;
}
}
我创建了 Junit 测试:
Assert.assertEquals( email.send(mail, SENDGRID_API_KEY), "");
我有这个错误:
The method assertEquals(Object, Object) in the type Assert is not applicable for the arguments (void, String)
【问题讨论】:
标签: java spring-boot junit4 sendgrid