解决了全局异常处理bug

This commit is contained in:
2025-06-24 16:15:39 +08:00
parent a0e60bece6
commit 502f079194
20 changed files with 237 additions and 280 deletions

View File

@ -36,12 +36,11 @@ class ProjectServiceImplTest {
CommonRequest req = new CommonRequest();
req.setId(10L);
when(projectService.getById(10L)).thenReturn(null);
// Act & Assert
RuntimeException ex = assertThrows(RuntimeException.class, () ->
service.queryProjectById(req)
);
assertTrue(ex.getMessage().contains("当前项目不存在"));
assertTrue(ex.getMessage().equals("当前项目不存在"));
// commonService.copyProperties 不应被调用
verify(commonService, never()).copyProperties(any(), any());