|
@@ -347,6 +347,36 @@ class TaskReminderDailyScheduledTaskContractTest {
|
|
|
verify(wechat, atLeastOnce()).send(any(com.etotem.cfc.dto.NotificationMessage.class));
|
|
verify(wechat, atLeastOnce()).send(any(com.etotem.cfc.dto.NotificationMessage.class));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
|
+ @DisplayName("晚默认开-3:config存在但dailyEnabled=null(历史默认回填) → 晚提醒发送;早提醒仍不发")
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
|
|
+ void eveningDefaultOn_nullDailyEnabled_afterBackfill() throws Exception {
|
|
|
|
|
+ TaskReminderConfigService cfg = mock(TaskReminderConfigService.class);
|
|
|
|
|
+ com.etotem.cfc.entity.TaskReminderConfig conf = new com.etotem.cfc.entity.TaskReminderConfig();
|
|
|
|
|
+ conf.setUserId(400L);
|
|
|
|
|
+ conf.setDailyEnabled(null); // 回填后的历史默认用户
|
|
|
|
|
+ when(cfg.loadAllConfigs()).thenReturn(new java.util.HashMap<>(
|
|
|
|
|
+ java.util.Collections.singletonMap(400L, conf)));
|
|
|
|
|
+ com.etotem.cfc.service.notification.NotificationChannel wechat =
|
|
|
|
|
+ mock(com.etotem.cfc.service.notification.NotificationChannel.class);
|
|
|
|
|
+ when(wechat.getChannelType()).thenReturn("wechat");
|
|
|
|
|
+ when(wechat.isEnabled()).thenReturn(true);
|
|
|
|
|
+ Object host = hostWithConfigAndChannel(cfg, wechat);
|
|
|
|
|
+
|
|
|
|
|
+ TaskMapper tm = mock(TaskMapper.class);
|
|
|
|
|
+ UserNotificationMapper un = mock(UserNotificationMapper.class);
|
|
|
|
|
+ inject(host, "taskMapper", tm);
|
|
|
|
|
+ inject(host, "userNotificationMapper", un);
|
|
|
|
|
+ Task done = doneToday(40L, "任务");
|
|
|
|
|
+ done.setExecutorId(400L);
|
|
|
|
|
+ when(tm.selectList(any())).thenReturn(new ArrayList<>(java.util.Collections.singletonList(done)));
|
|
|
|
|
+ when(un.selectCount(any())).thenReturn(0L);
|
|
|
|
|
+
|
|
|
|
|
+ // 晚提醒:null dailyEnabled → 发
|
|
|
|
|
+ call(host, "sendEveningSummary");
|
|
|
|
|
+ verify(wechat, atLeastOnce()).send(any(com.etotem.cfc.dto.NotificationMessage.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Test
|
|
@Test
|
|
|
@DisplayName("晚默认开-2:显式 daily_enabled=0 → 晚提醒跳过")
|
|
@DisplayName("晚默认开-2:显式 daily_enabled=0 → 晚提醒跳过")
|
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|