|
|
|
@ -53,10 +53,10 @@ class NotifySendServiceImplTest extends BaseMockitoUnitTest {
|
|
|
|
|
// mock NotifyMessageService 的方法
|
|
|
|
|
Long messageId = randomLongId();
|
|
|
|
|
when(notifyMessageService.createNotifyMessage(eq(userId), eq(UserTypeEnum.ADMIN.getValue()),
|
|
|
|
|
eq(template), eq(content), eq(templateParams))).thenReturn(messageId);
|
|
|
|
|
eq(template), eq(content), eq(templateParams), "xx", new HashMap<String, Object>(), "xxx")).thenReturn(messageId);
|
|
|
|
|
|
|
|
|
|
// 调用
|
|
|
|
|
Long resultMessageId = notifySendService.sendSingleNotifyToAdmin(userId, templateCode, templateParams);
|
|
|
|
|
Long resultMessageId = notifySendService.sendSingleNotifyToAdmin(userId, templateCode, templateParams, null, new HashMap<String, Object>(), "0");
|
|
|
|
|
// 断言
|
|
|
|
|
assertEquals(messageId, resultMessageId);
|
|
|
|
|
}
|
|
|
|
@ -81,7 +81,7 @@ class NotifySendServiceImplTest extends BaseMockitoUnitTest {
|
|
|
|
|
// mock NotifyMessageService 的方法
|
|
|
|
|
Long messageId = randomLongId();
|
|
|
|
|
when(notifyMessageService.createNotifyMessage(eq(userId), eq(UserTypeEnum.MEMBER.getValue()),
|
|
|
|
|
eq(template), eq(content), eq(templateParams))).thenReturn(messageId);
|
|
|
|
|
eq(template), eq(content), eq(templateParams), "xx", new HashMap<String, Object>(), "xxx")).thenReturn(messageId);
|
|
|
|
|
|
|
|
|
|
// 调用
|
|
|
|
|
Long resultMessageId = notifySendService.sendSingleNotifyToMember(userId, templateCode, templateParams);
|
|
|
|
@ -113,10 +113,10 @@ class NotifySendServiceImplTest extends BaseMockitoUnitTest {
|
|
|
|
|
// mock NotifyMessageService 的方法
|
|
|
|
|
Long messageId = randomLongId();
|
|
|
|
|
when(notifyMessageService.createNotifyMessage(eq(userId), eq(userType),
|
|
|
|
|
eq(template), eq(content), eq(templateParams))).thenReturn(messageId);
|
|
|
|
|
eq(template), eq(content), eq(templateParams), "xx", new HashMap<String, Object>(), "xxx")).thenReturn(messageId);
|
|
|
|
|
|
|
|
|
|
// 调用
|
|
|
|
|
Long resultMessageId = notifySendService.sendSingleNotify(userId, userType, templateCode, templateParams);
|
|
|
|
|
Long resultMessageId = notifySendService.sendSingleNotify(userId, userType, templateCode, templateParams, "xx", new HashMap<String, Object>(), "xxx");
|
|
|
|
|
// 断言
|
|
|
|
|
assertEquals(messageId, resultMessageId);
|
|
|
|
|
}
|
|
|
|
@ -141,11 +141,11 @@ class NotifySendServiceImplTest extends BaseMockitoUnitTest {
|
|
|
|
|
when(notifyTemplateService.getNotifyTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
|
|
|
|
|
|
|
|
|
// 调用
|
|
|
|
|
Long resultMessageId = notifySendService.sendSingleNotify(userId, userType, templateCode, templateParams);
|
|
|
|
|
Long resultMessageId = notifySendService.sendSingleNotify(userId, userType, templateCode, templateParams, "xx", new HashMap<String, Object>(), "xxx");
|
|
|
|
|
// 断言
|
|
|
|
|
assertNull(resultMessageId);
|
|
|
|
|
verify(notifyTemplateService, never()).formatNotifyTemplateContent(anyString(), anyMap());
|
|
|
|
|
verify(notifyMessageService, never()).createNotifyMessage(anyLong(), anyInt(), any(), anyString(), anyMap());
|
|
|
|
|
verify(notifyMessageService, never()).createNotifyMessage(anyLong(), anyInt(), any(), anyString(), anyMap(), "xx", new HashMap<String, Object>(), "xxx");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|