修复单元测试报错
This commit is contained in:
parent
d68fa54e55
commit
60d5d942c6
@ -84,6 +84,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
o.setParams(Lists.newArrayList("code", "op"));
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
});
|
});
|
||||||
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String title = RandomUtils.randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams)))
|
||||||
|
.thenReturn(title);
|
||||||
String content = RandomUtils.randomString();
|
String content = RandomUtils.randomString();
|
||||||
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
.thenReturn(content);
|
.thenReturn(content);
|
||||||
@ -101,7 +104,7 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
assertEquals(mailLogId, resultMailLogId);
|
assertEquals(mailLogId, resultMailLogId);
|
||||||
// 断言调用
|
// 断言调用
|
||||||
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(user.getEmail()),
|
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(user.getEmail()),
|
||||||
eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content));
|
eq(account.getId()), eq(template.getNickname()), eq(title), eq(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -122,6 +125,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
o.setParams(Lists.newArrayList("code", "op"));
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
});
|
});
|
||||||
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String title = RandomUtils.randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams)))
|
||||||
|
.thenReturn(title);
|
||||||
String content = RandomUtils.randomString();
|
String content = RandomUtils.randomString();
|
||||||
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
.thenReturn(content);
|
.thenReturn(content);
|
||||||
@ -139,7 +145,7 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
assertEquals(mailLogId, resultMailLogId);
|
assertEquals(mailLogId, resultMailLogId);
|
||||||
// 断言调用
|
// 断言调用
|
||||||
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail),
|
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail),
|
||||||
eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content));
|
eq(account.getId()), eq(template.getNickname()), eq(title), eq(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,6 +167,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
o.setParams(Lists.newArrayList("code", "op"));
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
});
|
});
|
||||||
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String title = RandomUtils.randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams)))
|
||||||
|
.thenReturn(title);
|
||||||
String content = RandomUtils.randomString();
|
String content = RandomUtils.randomString();
|
||||||
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
.thenReturn(content);
|
.thenReturn(content);
|
||||||
@ -178,7 +187,7 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
assertEquals(mailLogId, resultMailLogId);
|
assertEquals(mailLogId, resultMailLogId);
|
||||||
// 断言调用
|
// 断言调用
|
||||||
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail),
|
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail),
|
||||||
eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content));
|
eq(account.getId()), eq(template.getNickname()), eq(title), eq(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,6 +209,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
o.setParams(Lists.newArrayList("code", "op"));
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
});
|
});
|
||||||
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String title = RandomUtils.randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams)))
|
||||||
|
.thenReturn(title);
|
||||||
String content = RandomUtils.randomString();
|
String content = RandomUtils.randomString();
|
||||||
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
.thenReturn(content);
|
.thenReturn(content);
|
||||||
|
Loading…
Reference in New Issue
Block a user