Commit 9709621648a041b2154c147787324a331df1e14f

Authored by YunaiV
2 parents 9ed7c050 863a4202

merge:合并 master-jdk17 到 IM 开发分支

yudao-module-im/src/test/java/cn/iocoder/yudao/module/im/service/message/ImGroupMessageServiceImplTest.java
... ... @@ -768,6 +768,20 @@ public class ImGroupMessageServiceImplTest extends BaseMockitoUnitTest {
768 768 }
769 769 }
770 770  
  771 + @Test
  772 + public void testReadGroupMessages_quitMemberInvisibleMessage() {
  773 + // 准备:消息不在历史接收快照内
  774 + when(groupMessageMapper.selectById(100L)).thenReturn(ImGroupMessageDO.builder()
  775 + .id(100L).groupId(10L).senderId(2L).receiverUserIds(List.of(2L))
  776 + .sendTime(LocalDateTime.now()).build());
  777 +
  778 + // 调用并断言
  779 + ServiceException exception = assertThrows(ServiceException.class,
  780 + () -> groupMessageService.readGroupMessages(1L, 10L, 100L));
  781 + assertEquals(MESSAGE_NOT_IN_GROUP.getCode(), exception.getCode());
  782 + verify(conversationReadService, never()).updateConversationReadPosition(anyLong(), anyInt(), anyLong(), anyLong());
  783 + }
  784 +
771 785 // ========== 回执状态迁移 ==========
772 786  
773 787 @Test
... ...