diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java index 111037ed93..b55918ecbc 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java @@ -514,7 +514,7 @@ public class FileManagementControllerTests extends BaseTest { @Order(16) public void fileDownloadTestError() throws Exception { //下载不存在的文件 - mockMvc.perform(getRequestBuilder(FileManagementRequestUtils.URL_FILE_DOWNLOAD, IDGenerator.randomUUID())) + mockMvc.perform(getRequestBuilder(FileManagementRequestUtils.URL_FILE_DOWNLOAD, IDGenerator.nextNum())) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(status().is5xxServerError()); } @@ -1042,7 +1042,7 @@ public class FileManagementControllerTests extends BaseTest { checkLog(a1a1Node.getId(), OperationLogType.DELETE, FileManagementRequestUtils.URL_MODULE_DELETE); //删除不存在的节点 - this.requestGetWithOk(String.format(FileManagementRequestUtils.URL_MODULE_DELETE, IDGenerator.randomUUID())); + this.requestGetWithOk(String.format(FileManagementRequestUtils.URL_MODULE_DELETE, IDGenerator.nextNum())); // 测试删除根节点 this.requestGetWithOk(String.format(FileManagementRequestUtils.URL_MODULE_DELETE, ModuleConstants.DEFAULT_NODE_ID)); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/uid/IDGenerator.java b/backend/services/system-setting/src/main/java/io/metersphere/system/uid/IDGenerator.java index 1834c6a519..20e576b9ae 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/uid/IDGenerator.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/uid/IDGenerator.java @@ -13,7 +13,7 @@ public class IDGenerator { /** * 生成一个唯一的数字 */ - public static Long randomUUID() { + public static Long nextNum() { return DEFAULT_UID_GENERATOR.getUID(); } diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/user/UserControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/user/UserControllerTests.java index fe3a744b76..96bbb5460a 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/user/UserControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/user/UserControllerTests.java @@ -199,7 +199,7 @@ public class UserControllerTests extends BaseTest { public void testGetByEmailError() throws Exception { //测试使用任意参数,不能获取到任何用户信息 this.checkUserList(); - String url = UserRequestUtils.URL_USER_GET + IDGenerator.randomUUID(); + String url = UserRequestUtils.URL_USER_GET + IDGenerator.nextNum(); MvcResult mvcResult = userRequestUtils.responseGet(url); String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);