test(message): 更新通知类型为 MESSAGE

- 在 NoticeBuilder 中将通知类型从 other 修改为 MESSAGE
- 在 NoticeServiceTest 和 UserNoticeControllerTest 中更新相关测试用例- 统一使用 NoticeType.MESSAGE 作为通知类型
This commit is contained in:
zhuangtianxiang 2025-01-10 10:40:10 +08:00
parent 3db1dfa5fc
commit 91d99c7f6d
3 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ public class NoticeBuilder {
Notice notice = new Notice();
notice.setTitle(title);
notice.setContent(content);
notice.type = NoticeType.other;
notice.type = NoticeType.MESSAGE;
return notice;
}
}

View File

@ -63,7 +63,7 @@ public class UserNoticeControllerTest extends MockMvcConfigBase {
UserNoticeDto dto = new UserNoticeDto();
dto.setTitle("测试创建消息");
dto.setContent("测试创建消息");
dto.setType(NoticeType.other);
dto.setType(NoticeType.MESSAGE);
when(service.createByAdmin(any(UserNoticeDto.class))).thenReturn(true);
mockMvc.perform(post("/api/rest/message")
.with(csrf().asHeader())

View File

@ -38,7 +38,7 @@ public class NoticeServiceTest {
void setup() {
UserDetailsImpl userDetails = new UserDetailsImpl();
userDetails.setUsername("admin");
notice1 = NoticeBuilder.bMessage().type(NoticeType.other).title("A测试消息1").build();
notice1 = NoticeBuilder.bMessage().type(NoticeType.MESSAGE).title("A测试消息1").build();
noticeRepository.insert(notice1);
}
@ -59,7 +59,7 @@ public class NoticeServiceTest {
@Test
void createMessage() {
UserNoticeDto dto = new UserNoticeDto(new HashSet<>(Arrays.asList(1L, 2L)), NoticeType.other, false, false, false, "A测试消息3", "测试测试");
UserNoticeDto dto = new UserNoticeDto(new HashSet<>(Arrays.asList(1L, 2L)), NoticeType.MESSAGE, false, false, false, "A测试消息3", "测试测试");
service.createByAdmin(dto);
Notice notice = noticeRepository.selectOne(new LambdaQueryWrapper<Notice>().eq(Notice::getTitle, dto.getTitle()));
assertNotNull(notice.getId());