chore: 获取此集合的第一个元素

This commit is contained in:
fit2-zhao 2024-07-05 14:49:58 +08:00 committed by Craftsman
parent de8a216ef0
commit 90dfd84a4e
107 changed files with 340 additions and 343 deletions

View File

@ -131,7 +131,7 @@ public class XMLUtils {
list.add(jsonObject); list.add(jsonObject);
} }
if (list.size() == 1) { if (list.size() == 1) {
result.put(node.getName(), list.get(0)); result.put(node.getName(), list.getFirst());
} else { } else {
result.put(node.getName(), list); result.put(node.getName(), list);
} }

View File

@ -120,7 +120,7 @@ public abstract class SqlProcessorConverter extends MsProcessorConverter<SQLProc
.toList(); .toList();
} }
return CollectionUtils.isEmpty(dataSourceResults) ? null : dataSourceResults.get(0); return CollectionUtils.isEmpty(dataSourceResults) ? null : dataSourceResults.getFirst();
} }
protected TestElement getJdbcProcessor(SQLProcessor sqlProcessor, TestElement jdbcProcessor, DataSource dataSource) { protected TestElement getJdbcProcessor(SQLProcessor sqlProcessor, TestElement jdbcProcessor, DataSource dataSource) {

View File

@ -99,7 +99,7 @@ public class ApiFileResourceService {
if (CollectionUtils.isEmpty(folderFileNames)) { if (CollectionUtils.isEmpty(folderFileNames)) {
return null; return null;
} }
String[] pathSplit = folderFileNames.get(0).split("/"); String[] pathSplit = folderFileNames.getFirst().split("/");
return pathSplit[pathSplit.length - 1]; return pathSplit[pathSplit.length - 1];
} catch (Exception e) { } catch (Exception e) {
@ -407,7 +407,7 @@ public class ApiFileResourceService {
throw new MSException("file not found!"); throw new MSException("file not found!");
} }
} else { } else {
fileName = apiFileResources.get(0).getFileName(); fileName = apiFileResources.getFirst().getFileName();
} }
folder += "/" + request.getFileId(); folder += "/" + request.getFileId();

View File

@ -89,9 +89,6 @@ public class ApiTaskCenterService {
@Resource @Resource
private KafkaTemplate<String, String> kafkaTemplate; private KafkaTemplate<String, String> kafkaTemplate;
private static final String DEFAULT_SORT = "start_time desc"; private static final String DEFAULT_SORT = "start_time desc";
private final static String PROJECT_STOP = "/task/center/api/project/stop";
private final static String ORG_STOP = "/task/center/api/org/stop";
private final static String SYSTEM_STOP = "/task/center/api/system/stop";
/** /**
* 任务中心实时任务列表-项目级 * 任务中心实时任务列表-项目级

View File

@ -182,7 +182,7 @@ public class ApiDefinitionImportService {
applicationExample.createCriteria().andProjectIdEqualTo(request.getProjectId()).andTypeEqualTo("API_URL_REPEATABLE"); applicationExample.createCriteria().andProjectIdEqualTo(request.getProjectId()).andTypeEqualTo("API_URL_REPEATABLE");
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(applicationExample); List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(applicationExample);
if (CollectionUtils.isNotEmpty(projectApplications)) { if (CollectionUtils.isNotEmpty(projectApplications)) {
String typeValue = projectApplications.get(0).getTypeValue(); String typeValue = projectApplications.getFirst().getTypeValue();
}*/ }*/
//过滤(一次只导入一个协议) //过滤(一次只导入一个协议)
List<ApiDefinitionImportDetail> filterData = initData.stream().filter(t -> t.getProtocol().equals(request.getProtocol())).collect(Collectors.toList()); List<ApiDefinitionImportDetail> filterData = initData.stream().filter(t -> t.getProtocol().equals(request.getProtocol())).collect(Collectors.toList());

View File

@ -947,7 +947,7 @@ public class ApiDefinitionService extends MoveNodeService {
if (ApiDefinitionDocType.ALL.name().equals(request.getType()) || ApiDefinitionDocType.MODULE.name().equals(request.getType())) { if (ApiDefinitionDocType.ALL.name().equals(request.getType()) || ApiDefinitionDocType.MODULE.name().equals(request.getType())) {
List<ApiDefinitionDTO> list = extApiDefinitionMapper.listDoc(request); List<ApiDefinitionDTO> list = extApiDefinitionMapper.listDoc(request);
if (!list.isEmpty()) { if (!list.isEmpty()) {
ApiDefinitionDTO first = list.get(0); ApiDefinitionDTO first = list.getFirst();
handleBlob(first.getId(), first); handleBlob(first.getId(), first);
String docTitle; String docTitle;
if (ApiDefinitionDocType.ALL.name().equals(request.getType())) { if (ApiDefinitionDocType.ALL.name().equals(request.getType())) {

View File

@ -280,7 +280,7 @@ public class ApiTestCaseBatchRunService {
reportId = IDGenerator.nextStr(); reportId = IDGenerator.nextStr();
} else { } else {
// 独立报告执行到当前任务时初始化报告 // 独立报告执行到当前任务时初始化报告
reportId = initApiReport(runModeConfig, List.of(apiTestCase), queue.getUserId()).get(0).getApiReportId(); reportId = initApiReport(runModeConfig, List.of(apiTestCase), queue.getUserId()).getFirst().getApiReportId();
} }
if (apiTestCase == null) { if (apiTestCase == null) {

View File

@ -381,7 +381,7 @@ public class ApiDebugControllerTests extends BaseTest {
// 校验数据是否正确 // 校验数据是否正确
List<ApiDebugSimpleDTO> apiDebugList = getResultDataArray(mvcResult, ApiDebugSimpleDTO.class); List<ApiDebugSimpleDTO> apiDebugList = getResultDataArray(mvcResult, ApiDebugSimpleDTO.class);
Assertions.assertEquals(apiDebugList.size(), 2); Assertions.assertEquals(apiDebugList.size(), 2);
Assertions.assertEquals(apiDebugList.get(0), BeanUtils.copyBean(new ApiDebugSimpleDTO(), Assertions.assertEquals(apiDebugList.getFirst(), BeanUtils.copyBean(new ApiDebugSimpleDTO(),
apiDebugMapper.selectByPrimaryKey(addApiDebug.getId()))); apiDebugMapper.selectByPrimaryKey(addApiDebug.getId())));
Assertions.assertEquals(apiDebugList.get(1), Assertions.assertEquals(apiDebugList.get(1),
BeanUtils.copyBean(new ApiDebugSimpleDTO(), apiDebugMapper.selectByPrimaryKey(anotherAddApiDebug.getId()))); BeanUtils.copyBean(new ApiDebugSimpleDTO(), apiDebugMapper.selectByPrimaryKey(anotherAddApiDebug.getId())));
@ -468,7 +468,7 @@ public class ApiDebugControllerTests extends BaseTest {
Assertions.assertFalse(testResourcePools.isEmpty()); Assertions.assertFalse(testResourcePools.isEmpty());
ProjectTestResourcePool projectTestResourcePool = new ProjectTestResourcePool(); ProjectTestResourcePool projectTestResourcePool = new ProjectTestResourcePool();
projectTestResourcePool.setProjectId(DEFAULT_PROJECT_ID); projectTestResourcePool.setProjectId(DEFAULT_PROJECT_ID);
projectTestResourcePool.setTestResourcePoolId(testResourcePools.get(0).getId()); projectTestResourcePool.setTestResourcePoolId(testResourcePools.getFirst().getId());
projectTestResourcePoolMapper.insert(projectTestResourcePool); projectTestResourcePoolMapper.insert(projectTestResourcePool);
this.requestPost(DEBUG, request); this.requestPost(DEBUG, request);
projectTestResourcePoolMapper.deleteByExample(projectTestResourcePoolExample); projectTestResourcePoolMapper.deleteByExample(projectTestResourcePoolExample);
@ -753,7 +753,7 @@ public class ApiDebugControllerTests extends BaseTest {
request.setModuleId("root"); request.setModuleId("root");
request.setFileName("test-debug-file1"); request.setFileName("test-debug-file1");
request.setOriginalName("test-debug-file1.txt"); request.setOriginalName("test-debug-file1.txt");
request.setFileId(apiFileResources.get(0).getFileId()); request.setFileId(apiFileResources.getFirst().getFileId());
this.requestPost(TRANSFER, request).andExpect(status().isOk()); this.requestPost(TRANSFER, request).andExpect(status().isOk());
} }

View File

@ -409,7 +409,7 @@ public class ApiDebugModuleControllerTests extends BaseTest {
List<ApiDebugModule> apiDebugModules = apiDebugModuleMapper.selectByExample(example); List<ApiDebugModule> apiDebugModules = apiDebugModuleMapper.selectByExample(example);
assert CollectionUtils.isNotEmpty(apiDebugModules); assert CollectionUtils.isNotEmpty(apiDebugModules);
updateRequest = new ModuleUpdateRequest(); updateRequest = new ModuleUpdateRequest();
updateRequest.setId(apiDebugModules.get(0).getId()); updateRequest.setId(apiDebugModules.getFirst().getId());
updateRequest.setName("default-update-Project"); updateRequest.setName("default-update-Project");
requestPostPermissionTest(PermissionConstants.PROJECT_API_DEBUG_UPDATE, URL_MODULE_UPDATE, updateRequest); requestPostPermissionTest(PermissionConstants.PROJECT_API_DEBUG_UPDATE, URL_MODULE_UPDATE, updateRequest);
} }

View File

@ -222,7 +222,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
msHttpElement.setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpElement.getBody(), fileMetadataId)); msHttpElement.setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpElement.getBody(), fileMetadataId));
request.setRequest(getMsElementParam(msHttpElement)); request.setRequest(getMsElementParam(msHttpElement));
List<HttpResponse> msHttpResponse = MsHTTPElementTest.getMsHttpResponse(); List<HttpResponse> msHttpResponse = MsHTTPElementTest.getMsHttpResponse();
msHttpResponse.get(0).setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpResponse.get(0).getBody(), fileMetadataId)); msHttpResponse.getFirst().setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpResponse.getFirst().getBody(), fileMetadataId));
request.setResponse(msHttpResponse); request.setResponse(msHttpResponse);
uploadFileId = doUploadTempFile(getMockMultipartFile("api-add-file_upload.JPG")); uploadFileId = doUploadTempFile(getMockMultipartFile("api-add-file_upload.JPG"));
@ -256,7 +256,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
apiFileResourceExample.createCriteria().andResourceIdEqualTo(apiDefinition.getId()); apiFileResourceExample.createCriteria().andResourceIdEqualTo(apiDefinition.getId());
List<ApiFileResource> apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample); List<ApiFileResource> apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample);
Assertions.assertFalse(apiFileResources.isEmpty()); Assertions.assertFalse(apiFileResources.isEmpty());
apiTransferRequest.setFileId(apiFileResources.get(0).getFileId()); apiTransferRequest.setFileId(apiFileResources.getFirst().getFileId());
apiTransferRequest.setFileName("test-file_upload"); apiTransferRequest.setFileName("test-file_upload");
apiTransferRequest.setOriginalName("test-file_upload.JPG"); apiTransferRequest.setOriginalName("test-file_upload.JPG");
this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk()); this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk());
@ -899,7 +899,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
private void assertPateDate(Pager pageData) { private void assertPateDate(Pager pageData) {
List<ApiDefinitionDTO> apiDefinitions = ApiDataUtils.parseArray(JSON.toJSONString(pageData.getList()), ApiDefinitionDTO.class); List<ApiDefinitionDTO> apiDefinitions = ApiDataUtils.parseArray(JSON.toJSONString(pageData.getList()), ApiDefinitionDTO.class);
if (CollectionUtils.isNotEmpty(apiDefinitions)) { if (CollectionUtils.isNotEmpty(apiDefinitions)) {
ApiDefinitionDTO apiDefinitionDTO = apiDefinitions.get(0); ApiDefinitionDTO apiDefinitionDTO = apiDefinitions.getFirst();
// 判断用例数是否正确 // 判断用例数是否正确
ApiTestCaseExample example = new ApiTestCaseExample(); ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria() example.createCriteria()

View File

@ -475,7 +475,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
List<ApiDefinitionModule> apiDebugModules = apiDefinitionModuleMapper.selectByExample(example); List<ApiDefinitionModule> apiDebugModules = apiDefinitionModuleMapper.selectByExample(example);
assert CollectionUtils.isNotEmpty(apiDebugModules); assert CollectionUtils.isNotEmpty(apiDebugModules);
updateRequest = new ModuleUpdateRequest(); updateRequest = new ModuleUpdateRequest();
updateRequest.setId(apiDebugModules.get(0).getId()); updateRequest.setId(apiDebugModules.getFirst().getId());
updateRequest.setName("default-update-Project"); updateRequest.setName("default-update-Project");
requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_UPDATE, URL_MODULE_UPDATE, updateRequest); requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_UPDATE, URL_MODULE_UPDATE, updateRequest);
} }

View File

@ -273,7 +273,7 @@ public class ApiScenarioControllerTests extends BaseTest {
schedule.setValue("0 0 0/1 * * ? "); schedule.setValue("0 0 0/1 * * ? ");
} else { } else {
apiScenario.setGrouped(false); apiScenario.setGrouped(false);
apiScenario.setEnvironmentId(environments.get(0).getId()); apiScenario.setEnvironmentId(environments.getFirst().getId());
schedule.setValue("1111"); schedule.setValue("1111");
} }
scheduleMapper.insertSelective(schedule); scheduleMapper.insertSelective(schedule);
@ -356,7 +356,7 @@ public class ApiScenarioControllerTests extends BaseTest {
List<ApiScenarioStepRequest> steps = getApiScenarioStepRequests(); List<ApiScenarioStepRequest> steps = getApiScenarioStepRequests();
Map<String, Object> steptDetailMap = new HashMap<>(); Map<String, Object> steptDetailMap = new HashMap<>();
steptDetailMap.put(steps.get(1).getId(), getMsHttpElementParam()); steptDetailMap.put(steps.get(1).getId(), getMsHttpElementParam());
steptDetailMap.put(steps.get(0).getId(), getMsHttpElementParam()); steptDetailMap.put(steps.getFirst().getId(), getMsHttpElementParam());
request.setSteps(steps); request.setSteps(steps);
request.setStepDetails(steptDetailMap); request.setStepDetails(steptDetailMap);
request.setScenarioConfig(getScenarioConfig()); request.setScenarioConfig(getScenarioConfig());
@ -662,7 +662,7 @@ public class ApiScenarioControllerTests extends BaseTest {
for (ApiScenarioStepRequest step : steps) { for (ApiScenarioStepRequest step : steps) {
steptDetailMap.put(step.getId(), getMsHttpElementStr(msHttpElement)); steptDetailMap.put(step.getId(), getMsHttpElementStr(msHttpElement));
} }
fileMetadataStepId = steps.get(0).getId(); fileMetadataStepId = steps.getFirst().getId();
request.setSteps(steps); request.setSteps(steps);
request.setStepDetails(steptDetailMap); request.setStepDetails(steptDetailMap);
@ -675,10 +675,10 @@ public class ApiScenarioControllerTests extends BaseTest {
List<ApiScenarioCsv> apiScenarioCsv = apiScenarioCsvMapper.selectByExample(apiScenarioCsvExample); List<ApiScenarioCsv> apiScenarioCsv = apiScenarioCsvMapper.selectByExample(apiScenarioCsvExample);
Map<String, ApiScenarioCsv> collect = apiScenarioCsv.stream().collect(Collectors.toMap(ApiScenarioCsv::getFileId, t -> t)); Map<String, ApiScenarioCsv> collect = apiScenarioCsv.stream().collect(Collectors.toMap(ApiScenarioCsv::getFileId, t -> t));
// 验证修改步骤 // 验证修改步骤
steps.get(0).setName("test name update"); steps.getFirst().setName("test name update");
CsvVariable csvVariable = request.getScenarioConfig().getVariable().getCsvVariables().get(0); CsvVariable csvVariable = request.getScenarioConfig().getVariable().getCsvVariables().getFirst();
request.getScenarioConfig().getVariable().getCsvVariables().get(0).setId(collect.get(csvVariable.getFile().getFileId()).getId()); request.getScenarioConfig().getVariable().getCsvVariables().getFirst().setId(collect.get(csvVariable.getFile().getFileId()).getId());
CsvVariable csvVariable1 = request.getScenarioConfig().getVariable().getCsvVariables().get(0); CsvVariable csvVariable1 = request.getScenarioConfig().getVariable().getCsvVariables().getFirst();
request.getScenarioConfig().getVariable().getCsvVariables().get(1).setId(collect.get(csvVariable1.getFile().getFileId()).getId()); request.getScenarioConfig().getVariable().getCsvVariables().get(1).setId(collect.get(csvVariable1.getFile().getFileId()).getId());
this.requestPostWithOk(DEFAULT_UPDATE, request); this.requestPostWithOk(DEFAULT_UPDATE, request);
assertUpdateSteps(steps, steptDetailMap); assertUpdateSteps(steps, steptDetailMap);
@ -862,7 +862,7 @@ public class ApiScenarioControllerTests extends BaseTest {
apiFileResourceExample.createCriteria().andResourceIdEqualTo(addApiScenario.getId()); apiFileResourceExample.createCriteria().andResourceIdEqualTo(addApiScenario.getId());
List<ApiFileResource> apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample); List<ApiFileResource> apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample);
Assertions.assertFalse(apiFileResources.isEmpty()); Assertions.assertFalse(apiFileResources.isEmpty());
apiTransferRequest.setFileId(apiFileResources.get(0).getFileId()); apiTransferRequest.setFileId(apiFileResources.getFirst().getFileId());
apiTransferRequest.setFileName("test-scenario-file-1"); apiTransferRequest.setFileName("test-scenario-file-1");
apiTransferRequest.setOriginalName("test-scenario-file-1.txt"); apiTransferRequest.setOriginalName("test-scenario-file-1.txt");
this.requestPost(TRANSFER, apiTransferRequest).andExpect(status().isOk()); this.requestPost(TRANSFER, apiTransferRequest).andExpect(status().isOk());
@ -873,7 +873,7 @@ public class ApiScenarioControllerTests extends BaseTest {
public void testStepTransfer() throws Exception { public void testStepTransfer() throws Exception {
this.requestGetWithOk(TRANSFER_OPTIONS, DEFAULT_PROJECT_ID); this.requestGetWithOk(TRANSFER_OPTIONS, DEFAULT_PROJECT_ID);
ApiTransferRequest apiTransferRequest = new ApiTransferRequest(); ApiTransferRequest apiTransferRequest = new ApiTransferRequest();
apiTransferRequest.setSourceId(addApiScenarioSteps.get(0).getId()); apiTransferRequest.setSourceId(addApiScenarioSteps.getFirst().getId());
apiTransferRequest.setProjectId(DEFAULT_PROJECT_ID); apiTransferRequest.setProjectId(DEFAULT_PROJECT_ID);
apiTransferRequest.setModuleId("root"); apiTransferRequest.setModuleId("root");
apiTransferRequest.setLocal(true); apiTransferRequest.setLocal(true);
@ -1692,11 +1692,11 @@ public class ApiScenarioControllerTests extends BaseTest {
EnvironmentExample environmentExample = new EnvironmentExample(); EnvironmentExample environmentExample = new EnvironmentExample();
environmentExample.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andMockEqualTo(true); environmentExample.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andMockEqualTo(true);
List<Environment> environments = environmentMapper.selectByExample(environmentExample); List<Environment> environments = environmentMapper.selectByExample(environmentExample);
request.setEnvId(environments.get(0).getId()); request.setEnvId(environments.getFirst().getId());
requestPostAndReturn(BATCH_EDIT, request); requestPostAndReturn(BATCH_EDIT, request);
//判断数据的环境是不是environments.get(0).getId() //判断数据的环境是不是environments.getFirst().getId()
apiScenarios = apiScenarioMapper.selectByExample(example); apiScenarios = apiScenarioMapper.selectByExample(example);
apiScenarios.forEach(apiTestCase -> Assertions.assertEquals(apiTestCase.getEnvironmentId(), environments.get(0).getId())); apiScenarios.forEach(apiTestCase -> Assertions.assertEquals(apiTestCase.getEnvironmentId(), environments.getFirst().getId()));
//环境数据为空 //环境数据为空
request.setEnvId(null); request.setEnvId(null);
@ -2558,7 +2558,7 @@ public class ApiScenarioControllerTests extends BaseTest {
apiScenario.setEnvironmentId("scenario-environment-group-id"); apiScenario.setEnvironmentId("scenario-environment-group-id");
} else if (i <= 100) { } else if (i <= 100) {
apiScenario.setGrouped(false); apiScenario.setGrouped(false);
apiScenario.setEnvironmentId(environments.get(0).getId()); apiScenario.setEnvironmentId(environments.getFirst().getId());
} else if (i <= 150) { } else if (i <= 150) {
//带blob //带blob
ApiScenarioBlob apiScenarioBlob = new ApiScenarioBlob(); ApiScenarioBlob apiScenarioBlob = new ApiScenarioBlob();

View File

@ -402,7 +402,7 @@ public class ApiScenarioModuleControllerTests extends BaseTest {
List<ApiScenarioModule> apiDebugModules = apiScenarioModuleMapper.selectByExample(example); List<ApiScenarioModule> apiDebugModules = apiScenarioModuleMapper.selectByExample(example);
assert CollectionUtils.isNotEmpty(apiDebugModules); assert CollectionUtils.isNotEmpty(apiDebugModules);
updateRequest = new ModuleUpdateRequest(); updateRequest = new ModuleUpdateRequest();
updateRequest.setId(apiDebugModules.get(0).getId()); updateRequest.setId(apiDebugModules.getFirst().getId());
updateRequest.setName("default-update-Project"); updateRequest.setName("default-update-Project");
requestPostPermissionTest(PermissionConstants.PROJECT_API_SCENARIO_UPDATE, URL_MODULE_UPDATE, updateRequest); requestPostPermissionTest(PermissionConstants.PROJECT_API_SCENARIO_UPDATE, URL_MODULE_UPDATE, updateRequest);
} }

View File

@ -79,7 +79,7 @@ public class ApiShareControllerTests extends BaseTest {
List<ShareInfo> shareInfos = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(ShareInfoType.SINGLE.name(), JSON.toJSONString(request).getBytes(), "zh_CN"); List<ShareInfo> shareInfos = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(ShareInfoType.SINGLE.name(), JSON.toJSONString(request).getBytes(), "zh_CN");
Assertions.assertNotNull(shareInfos); Assertions.assertNotNull(shareInfos);
Assertions.assertEquals(1, shareInfos.size()); Assertions.assertEquals(1, shareInfos.size());
Assertions.assertEquals(shareInfoDTO.getId(), shareInfos.get(0).getId()); Assertions.assertEquals(shareInfoDTO.getId(), shareInfos.getFirst().getId());
Assertions.assertTrue(shareInfoDTO.getShareUrl().contains("?shareId=")); Assertions.assertTrue(shareInfoDTO.getShareUrl().contains("?shareId="));
request.setApiId("111"); request.setApiId("111");
@ -96,7 +96,7 @@ public class ApiShareControllerTests extends BaseTest {
List<ShareInfo> shareInfosModule = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(ShareInfoType.BATCH.name(), JSON.toJSONString(request).getBytes(), "zh_CN"); List<ShareInfo> shareInfosModule = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(ShareInfoType.BATCH.name(), JSON.toJSONString(request).getBytes(), "zh_CN");
Assertions.assertNotNull(shareInfosModule); Assertions.assertNotNull(shareInfosModule);
Assertions.assertEquals(1, shareInfosModule.size()); Assertions.assertEquals(1, shareInfosModule.size());
Assertions.assertEquals(shareInfoDTOModule.getId(), shareInfosModule.get(0).getId()); Assertions.assertEquals(shareInfoDTOModule.getId(), shareInfosModule.getFirst().getId());
Assertions.assertTrue(shareInfoDTOModule.getShareUrl().contains("?shareId=")); Assertions.assertTrue(shareInfoDTOModule.getShareUrl().contains("?shareId="));
// @@分享全部文档 // @@分享全部文档
@ -111,7 +111,7 @@ public class ApiShareControllerTests extends BaseTest {
List<ShareInfo> allShareInfos = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(ShareInfoType.BATCH.name(), JSON.toJSONString(request).getBytes(), "zh_CN"); List<ShareInfo> allShareInfos = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(ShareInfoType.BATCH.name(), JSON.toJSONString(request).getBytes(), "zh_CN");
Assertions.assertNotNull(allShareInfos); Assertions.assertNotNull(allShareInfos);
Assertions.assertEquals(1, allShareInfos.size()); Assertions.assertEquals(1, allShareInfos.size());
Assertions.assertEquals(allShareInfoDTO.getId(), allShareInfos.get(0).getId()); Assertions.assertEquals(allShareInfoDTO.getId(), allShareInfos.getFirst().getId());
Assertions.assertTrue(allShareInfoDTO.getShareUrl().contains("?shareId=")); Assertions.assertTrue(allShareInfoDTO.getShareUrl().contains("?shareId="));
assertTestShareView(allShareInfoDTO.getId()); assertTestShareView(allShareInfoDTO.getId());

View File

@ -346,7 +346,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
request.setPriority("P0"); request.setPriority("P0");
request.setStatus(ApiDefinitionStatus.PROCESSING.name()); request.setStatus(ApiDefinitionStatus.PROCESSING.name());
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag2"))); request.setTags(new LinkedHashSet<>(List.of("tag1", "tag2")));
request.setEnvironmentId(environments.get(0).getId()); request.setEnvironmentId(environments.getFirst().getId());
MsHTTPElement msHttpElement = MsHTTPElementTest.getMsHttpElement(); MsHTTPElement msHttpElement = MsHTTPElementTest.getMsHttpElement();
msHttpElement.setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpElement.getBody(), fileMetadataId)); msHttpElement.setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpElement.getBody(), fileMetadataId));
request.setRequest(getMsElementParam(msHttpElement)); request.setRequest(getMsElementParam(msHttpElement));
@ -750,7 +750,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
apiFileResourceExample.createCriteria().andResourceIdEqualTo(apiTestCase.getId()); apiFileResourceExample.createCriteria().andResourceIdEqualTo(apiTestCase.getId());
List<ApiFileResource> apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample); List<ApiFileResource> apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample);
Assertions.assertFalse(apiFileResources.isEmpty()); Assertions.assertFalse(apiFileResources.isEmpty());
apiTransferRequest.setFileId(apiFileResources.get(0).getFileId()); apiTransferRequest.setFileId(apiFileResources.getFirst().getFileId());
apiTransferRequest.setFileName("test-api-test-case-1"); apiTransferRequest.setFileName("test-api-test-case-1");
apiTransferRequest.setOriginalName("test-api-test-case-1.txt"); apiTransferRequest.setOriginalName("test-api-test-case-1.txt");
this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk()); this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk());
@ -1018,11 +1018,11 @@ public class ApiTestCaseControllerTests extends BaseTest {
EnvironmentExample environmentExample = new EnvironmentExample(); EnvironmentExample environmentExample = new EnvironmentExample();
environmentExample.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andMockEqualTo(true); environmentExample.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andMockEqualTo(true);
List<Environment> environments = environmentMapper.selectByExample(environmentExample); List<Environment> environments = environmentMapper.selectByExample(environmentExample);
request.setEnvironmentId(environments.get(0).getId()); request.setEnvironmentId(environments.getFirst().getId());
requestPostWithOkAndReturn(BATCH_EDIT, request); requestPostWithOkAndReturn(BATCH_EDIT, request);
//判断数据的环境是不是environments.get(0).getId() //判断数据的环境是不是environments.getFirst().getId()
caseList = apiTestCaseMapper.selectByExample(example); caseList = apiTestCaseMapper.selectByExample(example);
caseList.forEach(apiTestCase -> Assertions.assertEquals(apiTestCase.getEnvironmentId(), environments.get(0).getId())); caseList.forEach(apiTestCase -> Assertions.assertEquals(apiTestCase.getEnvironmentId(), environments.getFirst().getId()));
//环境数据为空 //环境数据为空
request.setEnvironmentId(null); request.setEnvironmentId(null);
this.requestPost(BATCH_EDIT, request, ERROR_REQUEST_MATCHER); this.requestPost(BATCH_EDIT, request, ERROR_REQUEST_MATCHER);

View File

@ -57,7 +57,7 @@ public class BaseFileManagementTestService {
FileAssociationExample example = new FileAssociationExample(); FileAssociationExample example = new FileAssociationExample();
example.createCriteria().andFileIdEqualTo(originFileId) example.createCriteria().andFileIdEqualTo(originFileId)
.andSourceIdEqualTo(resourceId); .andSourceIdEqualTo(resourceId);
FileAssociation fileAssociation = fileAssociationMapper.selectByExample(example).get(0); FileAssociation fileAssociation = fileAssociationMapper.selectByExample(example).getFirst();
return fileAssociationService.upgrade(fileAssociation.getId(), fileLogRecord); return fileAssociationService.upgrade(fileAssociation.getId(), fileLogRecord);
} }

View File

@ -59,10 +59,10 @@ public class BugAttachmentLogService {
BugFileDTO deleteFile; BugFileDTO deleteFile;
if (request.getAssociated()) { if (request.getAssociated()) {
// 关联 // 关联
deleteFile = allBugFiles.stream().filter(file -> !file.getLocal() && StringUtils.equals(request.getRefId(), file.getRefId())).toList().get(0); deleteFile = allBugFiles.stream().filter(file -> !file.getLocal() && StringUtils.equals(request.getRefId(), file.getRefId())).toList().getFirst();
} else { } else {
// 本地 // 本地
deleteFile = allBugFiles.stream().filter(file -> file.getLocal() && StringUtils.equals(request.getRefId(), file.getRefId())).toList().get(0); deleteFile = allBugFiles.stream().filter(file -> file.getLocal() && StringUtils.equals(request.getRefId(), file.getRefId())).toList().getFirst();
} }
LogDTO dto = buildUpdateLog(bug); LogDTO dto = buildUpdateLog(bug);
dto.setModifiedValue(JSON.toJSONBytes(originalFileNames)); dto.setModifiedValue(JSON.toJSONBytes(originalFileNames));

View File

@ -510,7 +510,7 @@ public class BugAttachmentService {
FileAssociation association = fileAssociationMapper.selectByPrimaryKey(refId); FileAssociation association = fileAssociationMapper.selectByPrimaryKey(refId);
FileMetadataExample example = new FileMetadataExample(); FileMetadataExample example = new FileMetadataExample();
example.createCriteria().andIdEqualTo(association.getFileId()); example.createCriteria().andIdEqualTo(association.getFileId());
FileMetadata fileMetadata = fileMetadataMapper.selectByExample(example).get(0); FileMetadata fileMetadata = fileMetadataMapper.selectByExample(example).getFirst();
// 取消关联的附件同步至平台 // 取消关联的附件同步至平台
if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) { if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) {
File deleteTmpFile = new File(FilenameUtils.normalize(LocalRepositoryDir.getBugTmpDir() + File.separator + fileMetadata.getName() + "." + fileMetadata.getType())); File deleteTmpFile = new File(FilenameUtils.normalize(LocalRepositoryDir.getBugTmpDir() + File.separator + fileMetadata.getName() + "." + fileMetadata.getType()));
@ -628,7 +628,7 @@ public class BugAttachmentService {
if (CollectionUtils.isEmpty(bugLocalAttachments)) { if (CollectionUtils.isEmpty(bugLocalAttachments)) {
return null; return null;
} }
return bugLocalAttachments.get(0); return bugLocalAttachments.getFirst();
} }
/** /**
@ -700,7 +700,7 @@ public class BugAttachmentService {
if (CollectionUtils.isEmpty(folderFileNames)) { if (CollectionUtils.isEmpty(folderFileNames)) {
return null; return null;
} }
String[] pathSplit = folderFileNames.get(0).split("/"); String[] pathSplit = folderFileNames.getFirst().split("/");
return pathSplit[pathSplit.length - 1]; return pathSplit[pathSplit.length - 1];
} catch (Exception e) { } catch (Exception e) {
@ -769,7 +769,7 @@ public class BugAttachmentService {
bytes = getPreviewImg(fileName, fileId, compressed); bytes = getPreviewImg(fileName, fileId, compressed);
} else { } else {
//在正式目录获取 //在正式目录获取
BugLocalAttachment attachment = bugAttachments.get(0); BugLocalAttachment attachment = bugAttachments.getFirst();
fileName = attachment.getFileName(); fileName = attachment.getFileName();
FileRequest fileRequest = buildBugFileRequest(projectId, attachment.getBugId(), attachment.getFileId(), attachment.getFileName(), compressed); FileRequest fileRequest = buildBugFileRequest(projectId, attachment.getBugId(), attachment.getFileId(), attachment.getFileName(), compressed);
try { try {

View File

@ -121,6 +121,6 @@ public class BugLogService {
originalBug.setDescription(bugContent.getDescription()); originalBug.setDescription(bugContent.getDescription());
} }
// 缺陷自定义字段 // 缺陷自定义字段
return bugService.handleCustomField(List.of(originalBug), originalBug.getProjectId()).get(0); return bugService.handleCustomField(List.of(originalBug), originalBug.getProjectId()).getFirst();
} }
} }

View File

@ -29,8 +29,8 @@ public class BugScheduleServiceImpl implements BaseBugScheduleService {
List<ProjectApplication> syncCron = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.BUG.BUG_SYNC.name() + "_" + ProjectApplicationType.BUG_SYNC_CONFIG.CRON_EXPRESSION.name())).toList(); List<ProjectApplication> syncCron = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.BUG.BUG_SYNC.name() + "_" + ProjectApplicationType.BUG_SYNC_CONFIG.CRON_EXPRESSION.name())).toList();
List<ProjectApplication> syncEnable = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.BUG.BUG_SYNC.name() + "_" + ProjectApplicationType.BUG_SYNC_CONFIG.SYNC_ENABLE.name())).toList(); List<ProjectApplication> syncEnable = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.BUG.BUG_SYNC.name() + "_" + ProjectApplicationType.BUG_SYNC_CONFIG.SYNC_ENABLE.name())).toList();
if (CollectionUtils.isNotEmpty(syncCron)) { if (CollectionUtils.isNotEmpty(syncCron)) {
Boolean enable = Boolean.valueOf(syncEnable.get(0).getTypeValue()); Boolean enable = Boolean.valueOf(syncEnable.getFirst().getTypeValue());
String typeValue = syncCron.get(0).getTypeValue(); String typeValue = syncCron.getFirst().getTypeValue();
Schedule schedule = scheduleService.getScheduleByResource(projectId, BugSyncJob.class.getName()); Schedule schedule = scheduleService.getScheduleByResource(projectId, BugSyncJob.class.getName());
Optional<Schedule> optional = Optional.ofNullable(schedule); Optional<Schedule> optional = Optional.ofNullable(schedule);
optional.ifPresentOrElse(s -> { optional.ifPresentOrElse(s -> {

View File

@ -727,7 +727,7 @@ public class BugService {
// 平台默认模板 // 平台默认模板
Template pluginDefaultTemplate = projectTemplateService.getPluginBugTemplate(project.getId()); Template pluginDefaultTemplate = projectTemplateService.getPluginBugTemplate(project.getId());
List<ProjectTemplateOptionDTO> templateOption = projectTemplateService.getOption(project.getId(), TemplateScene.BUG.name()); List<ProjectTemplateOptionDTO> templateOption = projectTemplateService.getOption(project.getId(), TemplateScene.BUG.name());
ProjectTemplateOptionDTO defaultProjectTemplate = templateOption.stream().filter(ProjectTemplateOptionDTO::getEnableDefault).toList().get(0); ProjectTemplateOptionDTO defaultProjectTemplate = templateOption.stream().filter(ProjectTemplateOptionDTO::getEnableDefault).toList().getFirst();
if (isPluginDefaultTemplate(defaultProjectTemplate.getId(), pluginDefaultTemplate)) { if (isPluginDefaultTemplate(defaultProjectTemplate.getId(), pluginDefaultTemplate)) {
BeanUtils.copyBean(msDefaultTemplate, pluginDefaultTemplate); BeanUtils.copyBean(msDefaultTemplate, pluginDefaultTemplate);
} else { } else {
@ -945,7 +945,7 @@ public class BugService {
if (StringUtils.isBlank(statusField.get().getValue()) && StringUtils.equalsIgnoreCase(BugPlatform.LOCAL.getName(), platformName)) { if (StringUtils.isBlank(statusField.get().getValue()) && StringUtils.equalsIgnoreCase(BugPlatform.LOCAL.getName(), platformName)) {
// Local平台设置状态默认值为状态流-开始状态 // Local平台设置状态默认值为状态流-开始状态
List<SelectOption> localStartStatusItem = bugStatusService.getToStatusItemOptionOnLocal(request.getProjectId(), StringUtils.EMPTY); List<SelectOption> localStartStatusItem = bugStatusService.getToStatusItemOptionOnLocal(request.getProjectId(), StringUtils.EMPTY);
bug.setStatus(localStartStatusItem.get(0).getValue()); bug.setStatus(localStartStatusItem.getFirst().getValue());
} else { } else {
bug.setStatus(statusField.get().getValue()); bug.setStatus(statusField.get().getValue());
} }
@ -1036,7 +1036,7 @@ public class BugService {
if (CollectionUtils.isEmpty(bugs)) { if (CollectionUtils.isEmpty(bugs)) {
throw new MSException(BUG_NOT_EXIST); throw new MSException(BUG_NOT_EXIST);
} }
return bugs.get(0); return bugs.getFirst();
} }
/** /**
@ -1491,13 +1491,13 @@ public class BugService {
.replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + updateBug.getProjectId() + "/" + fileId + "/false\"")); .replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + updateBug.getProjectId() + "/" + fileId + "/false\""));
if (updateBug.getPlatformDefaultTemplate()) { if (updateBug.getPlatformDefaultTemplate()) {
// 来自富文本自定义字段 // 来自富文本自定义字段
PlatformCustomFieldItemDTO descriptionField = updateBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getCustomData(), "description")).toList().get(0); PlatformCustomFieldItemDTO descriptionField = updateBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getCustomData(), "description")).toList().getFirst();
descriptionField.setValue(updateBug.getDescription()); descriptionField.setValue(updateBug.getDescription());
} }
} else { } else {
// 来自富文本自定义字段 // 来自富文本自定义字段
PlatformCustomFieldItemDTO richTextField = updateBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getType(), PlatformCustomFieldType.RICH_TEXT.name()) PlatformCustomFieldItemDTO richTextField = updateBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getType(), PlatformCustomFieldType.RICH_TEXT.name())
&& field.getValue() != null && StringUtils.contains(field.getValue().toString(), "alt=\"" + key + "\"")).toList().get(0); && field.getValue() != null && StringUtils.contains(field.getValue().toString(), "alt=\"" + key + "\"")).toList().getFirst();
richTextField.setValue(richTextField.getValue().toString().replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + updateBug.getProjectId() + "/" + fileId + "/false\"")); richTextField.setValue(richTextField.getValue().toString().replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + updateBug.getProjectId() + "/" + fileId + "/false\""));
} }
})); }));
@ -2002,13 +2002,13 @@ public class BugService {
.replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + platformBug.getProjectId() + "/" + fileId + "/false\"")); .replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + platformBug.getProjectId() + "/" + fileId + "/false\""));
if (platformBug.getPlatformDefaultTemplate()) { if (platformBug.getPlatformDefaultTemplate()) {
// 来自富文本自定义字段 // 来自富文本自定义字段
PlatformCustomFieldItemDTO descriptionField = platformBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getCustomData(), "description")).toList().get(0); PlatformCustomFieldItemDTO descriptionField = platformBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getCustomData(), "description")).toList().getFirst();
descriptionField.setValue(platformBug.getDescription()); descriptionField.setValue(platformBug.getDescription());
} }
} else { } else {
// 来自富文本自定义字段 // 来自富文本自定义字段
PlatformCustomFieldItemDTO richTextField = platformBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getType(), PlatformCustomFieldType.RICH_TEXT.name()) PlatformCustomFieldItemDTO richTextField = platformBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getType(), PlatformCustomFieldType.RICH_TEXT.name())
&& field.getValue() != null && StringUtils.contains(field.getValue().toString(), "alt=\"" + key + "\"")).toList().get(0); && field.getValue() != null && StringUtils.contains(field.getValue().toString(), "alt=\"" + key + "\"")).toList().getFirst();
richTextField.setValue(richTextField.getValue().toString().replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + platformBug.getProjectId() + "/" + fileId + "/false\"")); richTextField.setValue(richTextField.getValue().toString().replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + platformBug.getProjectId() + "/" + fileId + "/false\""));
} }
})); }));

View File

@ -113,7 +113,7 @@ public class BugStatusService {
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_time desc");
List<Bug> bugs = bugMapper.selectByExample(example); List<Bug> bugs = bugMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(bugs)) { if (CollectionUtils.isNotEmpty(bugs)) {
return bugs.get(0).getPlatformBugId(); return bugs.getFirst().getPlatformBugId();
} else { } else {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }

View File

@ -93,7 +93,7 @@ public class BugAttachmentControllerTests extends BaseTest {
BugUploadFileRequest request = new BugUploadFileRequest(); BugUploadFileRequest request = new BugUploadFileRequest();
request.setBugId("default-attachment-bug-id"); request.setBugId("default-attachment-bug-id");
request.setProjectId("default-project-for-attachment"); request.setProjectId("default-project-for-attachment");
request.setSelectIds(List.of(unRelatedFiles.get(0).getId())); request.setSelectIds(List.of(unRelatedFiles.getFirst().getId()));
MultiValueMap<String, Object> paramMap1 = getDefaultMultiPartParam(request, null); MultiValueMap<String, Object> paramMap1 = getDefaultMultiPartParam(request, null);
this.requestMultipartWithOk(BUG_ATTACHMENT_UPLOAD, paramMap1); this.requestMultipartWithOk(BUG_ATTACHMENT_UPLOAD, paramMap1);
String filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/test.xlsx")).getPath(); String filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/test.xlsx")).getPath();
@ -105,7 +105,7 @@ public class BugAttachmentControllerTests extends BaseTest {
request.setSelectIds(List.of("not-exist-file-id")); request.setSelectIds(List.of("not-exist-file-id"));
MultiValueMap<String, Object> paramMap4 = getDefaultMultiPartParam(request, null); MultiValueMap<String, Object> paramMap4 = getDefaultMultiPartParam(request, null);
this.requestMultipart(BUG_ATTACHMENT_UPLOAD, paramMap4); this.requestMultipart(BUG_ATTACHMENT_UPLOAD, paramMap4);
request.setSelectIds(List.of(unRelatedFiles.get(0).getId())); request.setSelectIds(List.of(unRelatedFiles.getFirst().getId()));
MultiValueMap<String, Object> paramMap5 = getDefaultMultiPartParam(request, null); MultiValueMap<String, Object> paramMap5 = getDefaultMultiPartParam(request, null);
this.requestMultipart(BUG_ATTACHMENT_UPLOAD, paramMap5); this.requestMultipart(BUG_ATTACHMENT_UPLOAD, paramMap5);
MultiValueMap<String, Object> paramMap6 = getDefaultMultiPartParam(request, file); MultiValueMap<String, Object> paramMap6 = getDefaultMultiPartParam(request, file);

View File

@ -45,10 +45,10 @@ public class BugCommentControllerTests extends BaseTest {
ResultHolder resultHolder = JSON.parseObject(sortData, ResultHolder.class); ResultHolder resultHolder = JSON.parseObject(sortData, ResultHolder.class);
List<BugCommentDTO> comments = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), BugCommentDTO.class); List<BugCommentDTO> comments = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), BugCommentDTO.class);
Assertions.assertTrue(CollectionUtils.isNotEmpty(comments)); Assertions.assertTrue(CollectionUtils.isNotEmpty(comments));
Assertions.assertTrue(StringUtils.equals("default-bug-comment-id-3", comments.get(0).getId())); Assertions.assertTrue(StringUtils.equals("default-bug-comment-id-3", comments.getFirst().getId()));
// 第二条评论的子评论不为空且ID为default-bug-comment-id-2 // 第二条评论的子评论不为空且ID为default-bug-comment-id-2
Assertions.assertTrue(CollectionUtils.isNotEmpty(comments.get(1).getChildComments()) && Assertions.assertTrue(CollectionUtils.isNotEmpty(comments.get(1).getChildComments()) &&
StringUtils.equals("default-bug-comment-id-2", comments.get(1).getChildComments().get(0).getId())); StringUtils.equals("default-bug-comment-id-2", comments.get(1).getChildComments().getFirst().getId()));
} }
@Test @Test

View File

@ -155,7 +155,7 @@ public class BugControllerTests extends BaseTest {
// 返回的数据量不超过规定要返回的数据量相同 // 返回的数据量不超过规定要返回的数据量相同
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= bugRequest.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= bugRequest.getPageSize());
// 返回值中取出第一条数据, 并判断是否包含关键字default // 返回值中取出第一条数据, 并判断是否包含关键字default
BugDTO bugDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), BugDTO.class).get(0); BugDTO bugDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), BugDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(bugDTO.getTitle(), bugRequest.getKeyword()) Assertions.assertTrue(StringUtils.contains(bugDTO.getTitle(), bugRequest.getKeyword())
|| StringUtils.contains(bugDTO.getId(), bugRequest.getKeyword())); || StringUtils.contains(bugDTO.getId(), bugRequest.getKeyword()));
@ -168,7 +168,7 @@ public class BugControllerTests extends BaseTest {
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class); ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class); Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
// 返回值中取出第一条ID最大的数据, 并判断是否是default-bug // 返回值中取出第一条ID最大的数据, 并判断是否是default-bug
BugDTO maxBugDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), BugDTO.class).get(0); BugDTO maxBugDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), BugDTO.class).getFirst();
Assertions.assertTrue(maxBugDTO.getId().contains("default")); Assertions.assertTrue(maxBugDTO.getId().contains("default"));
// 拖拽 // 拖拽
@ -884,7 +884,7 @@ public class BugControllerTests extends BaseTest {
private Bug getAddJiraBug() { private Bug getAddJiraBug() {
BugExample example = new BugExample(); BugExample example = new BugExample();
example.createCriteria().andTitleEqualTo("这是一个系统Jira模板创建的缺陷"); example.createCriteria().andTitleEqualTo("这是一个系统Jira模板创建的缺陷");
return bugMapper.selectByExample(example).get(0); return bugMapper.selectByExample(example).getFirst();
} }
/** /**
@ -895,7 +895,7 @@ public class BugControllerTests extends BaseTest {
private BugLocalAttachment getAddJiraLocalFile() { private BugLocalAttachment getAddJiraLocalFile() {
BugLocalAttachmentExample example = new BugLocalAttachmentExample(); BugLocalAttachmentExample example = new BugLocalAttachmentExample();
example.createCriteria().andBugIdEqualTo(getAddJiraBug().getId()); example.createCriteria().andBugIdEqualTo(getAddJiraBug().getId());
return bugLocalAttachmentMapper.selectByExample(example).get(0); return bugLocalAttachmentMapper.selectByExample(example).getFirst();
} }
/** /**
@ -906,7 +906,7 @@ public class BugControllerTests extends BaseTest {
private FileAssociation getAddJiraAssociateFile() { private FileAssociation getAddJiraAssociateFile() {
FileAssociationExample example = new FileAssociationExample(); FileAssociationExample example = new FileAssociationExample();
example.createCriteria().andSourceIdEqualTo(getAddJiraBug().getId()).andSourceTypeEqualTo(FileAssociationSourceUtil.SOURCE_TYPE_BUG); example.createCriteria().andSourceIdEqualTo(getAddJiraBug().getId()).andSourceTypeEqualTo(FileAssociationSourceUtil.SOURCE_TYPE_BUG);
return fileAssociationMapper.selectByExample(example).get(0); return fileAssociationMapper.selectByExample(example).getFirst();
} }
/** /**

View File

@ -117,7 +117,7 @@ public class BugRelateCaseControllerTests extends BaseTest {
// 返回的数据量不超过规定要返回的数据量相同 // 返回的数据量不超过规定要返回的数据量相同
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
// 返回值中取出第一条数据, 并判断是否包含关键字default // 返回值中取出第一条数据, 并判断是否包含关键字default
BugRelateCaseDTO bugRelateCaseDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), BugRelateCaseDTO.class).get(0); BugRelateCaseDTO bugRelateCaseDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), BugRelateCaseDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(bugRelateCaseDTO.getRelateCaseName(), request.getKeyword())); Assertions.assertTrue(StringUtils.contains(bugRelateCaseDTO.getRelateCaseName(), request.getKeyword()));
} }

View File

@ -140,7 +140,7 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
collect.forEach((caseId, caseList) -> { collect.forEach((caseId, caseList) -> {
FunctionalCase functionalCase = new FunctionalCase(); FunctionalCase functionalCase = new FunctionalCase();
functionalCase.setId(caseId); functionalCase.setId(caseId);
functionalCase.setReviewStatus(caseList.get(0).getStatus()); functionalCase.setReviewStatus(caseList.getFirst().getStatus());
mapper.updateByPrimaryKeySelective(functionalCase); mapper.updateByPrimaryKeySelective(functionalCase);
}); });
} }

View File

@ -214,7 +214,7 @@ public class CaseReviewFunctionalCaseService {
private String getMyStatus(List<CaseReviewHistory> histories, String viewStatusUserId) { private String getMyStatus(List<CaseReviewHistory> histories, String viewStatusUserId) {
List<CaseReviewHistory> list = histories.stream().filter(history -> StringUtils.equalsIgnoreCase(history.getCreateUser(), viewStatusUserId)).toList(); List<CaseReviewHistory> list = histories.stream().filter(history -> StringUtils.equalsIgnoreCase(history.getCreateUser(), viewStatusUserId)).toList();
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
return list.get(0).getStatus(); return list.getFirst().getStatus();
} }
//重新提审记录 //重新提审记录
@ -328,7 +328,7 @@ public class CaseReviewFunctionalCaseService {
ProjectApplicationExample example = new ProjectApplicationExample(); ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andProjectIdEqualTo(request.getProjectId()).andTypeEqualTo(ProjectApplicationType.CASE.CASE_RE_REVIEW.name()); example.createCriteria().andProjectIdEqualTo(request.getProjectId()).andTypeEqualTo(ProjectApplicationType.CASE.CASE_RE_REVIEW.name());
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example); List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(projectApplications) && Boolean.valueOf(projectApplications.get(0).getTypeValue())) { if (CollectionUtils.isNotEmpty(projectApplications) && Boolean.valueOf(projectApplications.getFirst().getTypeValue())) {
if (!StringUtils.equals(name, request.getName()) if (!StringUtils.equals(name, request.getName())
|| !StringUtils.equals(new String(blob.getSteps() == null ? new byte[0] : blob.getSteps(), StandardCharsets.UTF_8), request.getSteps()) || !StringUtils.equals(new String(blob.getSteps() == null ? new byte[0] : blob.getSteps(), StandardCharsets.UTF_8), request.getSteps())
|| !StringUtils.equals(new String(blob.getTextDescription() == null ? new byte[0] : blob.getTextDescription(), StandardCharsets.UTF_8), request.getTextDescription()) || !StringUtils.equals(new String(blob.getTextDescription() == null ? new byte[0] : blob.getTextDescription(), StandardCharsets.UTF_8), request.getTextDescription())
@ -526,10 +526,10 @@ public class CaseReviewFunctionalCaseService {
AtomicInteger passCount = new AtomicInteger(); AtomicInteger passCount = new AtomicInteger();
AtomicInteger unPassCount = new AtomicInteger(); AtomicInteger unPassCount = new AtomicInteger();
hasReviewedUserMap.forEach((k, v) -> { hasReviewedUserMap.forEach((k, v) -> {
if (StringUtils.equalsIgnoreCase(v.get(0).getStatus(), FunctionalCaseReviewStatus.PASS.toString())) { if (StringUtils.equalsIgnoreCase(v.getFirst().getStatus(), FunctionalCaseReviewStatus.PASS.toString())) {
passCount.set(passCount.get() + 1); passCount.set(passCount.get() + 1);
} }
if (StringUtils.equalsIgnoreCase(v.get(0).getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())) { if (StringUtils.equalsIgnoreCase(v.getFirst().getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())) {
unPassCount.set(unPassCount.get() + 1); unPassCount.set(unPassCount.get() + 1);
} }
}); });
@ -646,7 +646,7 @@ public class CaseReviewFunctionalCaseService {
} }
private String newReviewStatus(List<String> historyUsers, List<String> newUsers, List<CaseReviewHistory> reviewHistories, List<CaseReviewFunctionalCaseUser> newReviewers) { private String newReviewStatus(List<String> historyUsers, List<String> newUsers, List<CaseReviewHistory> reviewHistories, List<CaseReviewFunctionalCaseUser> newReviewers) {
CaseReviewHistory caseReviewHistory = reviewHistories.get(0); CaseReviewHistory caseReviewHistory = reviewHistories.getFirst();
if (newUsers.contains(caseReviewHistory.getCreateUser()) && FunctionalCaseReviewStatus.RE_REVIEWED.name().equals(caseReviewHistory.getStatus())) { if (newUsers.contains(caseReviewHistory.getCreateUser()) && FunctionalCaseReviewStatus.RE_REVIEWED.name().equals(caseReviewHistory.getStatus())) {
return FunctionalCaseReviewStatus.RE_REVIEWED.name(); return FunctionalCaseReviewStatus.RE_REVIEWED.name();
} }
@ -731,7 +731,7 @@ public class CaseReviewFunctionalCaseService {
Map<String, List<FunctionalCaseModuleDTO>> projectModuleMap = functionalModuleIds.stream().collect(Collectors.groupingBy(FunctionalCaseModule::getProjectId)); Map<String, List<FunctionalCaseModuleDTO>> projectModuleMap = functionalModuleIds.stream().collect(Collectors.groupingBy(FunctionalCaseModule::getProjectId));
if (MapUtils.isEmpty(projectModuleMap)) { if (MapUtils.isEmpty(projectModuleMap)) {
projectRootMap.forEach((projectId, projectOptionDTOList) -> { projectRootMap.forEach((projectId, projectOptionDTOList) -> {
BaseTreeNode projectNode = new BaseTreeNode(projectId, projectOptionDTOList.get(0).getProjectName(), Project.class.getName()); BaseTreeNode projectNode = new BaseTreeNode(projectId, projectOptionDTOList.getFirst().getProjectName(), Project.class.getName());
returnList.add(projectNode); returnList.add(projectNode);
BaseTreeNode defaultNode = functionalCaseModuleService.getDefaultModule(Translator.get("functional_case.module.default.name")); BaseTreeNode defaultNode = functionalCaseModuleService.getDefaultModule(Translator.get("functional_case.module.default.name"));
projectNode.addChild(defaultNode); projectNode.addChild(defaultNode);
@ -739,7 +739,7 @@ public class CaseReviewFunctionalCaseService {
return returnList; return returnList;
} }
projectModuleMap.forEach((projectId, moduleList) -> { projectModuleMap.forEach((projectId, moduleList) -> {
BaseTreeNode projectNode = new BaseTreeNode(projectId, moduleList.get(0).getProjectName(), Project.class.getName()); BaseTreeNode projectNode = new BaseTreeNode(projectId, moduleList.getFirst().getProjectName(), Project.class.getName());
returnList.add(projectNode); returnList.add(projectNode);
List<String> projectModuleIds = moduleList.stream().map(FunctionalCaseModule::getId).toList(); List<String> projectModuleIds = moduleList.stream().map(FunctionalCaseModule::getId).toList();
List<BaseTreeNode> nodeByNodeIds = functionalCaseModuleService.getNodeByNodeIds(projectModuleIds); List<BaseTreeNode> nodeByNodeIds = functionalCaseModuleService.getNodeByNodeIds(projectModuleIds);
@ -804,8 +804,8 @@ public class CaseReviewFunctionalCaseService {
List<OptionDTO> optionDTOS = new ArrayList<>(); List<OptionDTO> optionDTOS = new ArrayList<>();
collect.forEach((k, v) -> { collect.forEach((k, v) -> {
OptionDTO optionDTO = new OptionDTO(); OptionDTO optionDTO = new OptionDTO();
optionDTO.setId(v.get(0).getUserName()); optionDTO.setId(v.getFirst().getUserName());
optionDTO.setName(v.get(0).getStatus()); optionDTO.setName(v.getFirst().getStatus());
optionDTOS.add(optionDTO); optionDTOS.add(optionDTO);
}); });
return optionDTOS; return optionDTOS;

View File

@ -290,7 +290,7 @@ public class FunctionalCaseAttachmentService {
example.createCriteria().andFileIdEqualTo(request.getFileId()).andCaseIdEqualTo(request.getCaseId()); example.createCriteria().andFileIdEqualTo(request.getFileId()).andCaseIdEqualTo(request.getCaseId());
List<FunctionalCaseAttachment> caseAttachments = functionalCaseAttachmentMapper.selectByExample(example); List<FunctionalCaseAttachment> caseAttachments = functionalCaseAttachmentMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(caseAttachments)) { if (CollectionUtils.isNotEmpty(caseAttachments)) {
FunctionalCaseAttachment attachment = caseAttachments.get(0); FunctionalCaseAttachment attachment = caseAttachments.getFirst();
FileRequest fileRequest = new FileRequest(); FileRequest fileRequest = new FileRequest();
fileRequest.setFileName(attachment.getFileName()); fileRequest.setFileName(attachment.getFileName());
fileRequest.setFolder(DefaultRepositoryDir.getFunctionalCaseDir(request.getProjectId(), request.getCaseId()) + "/" + attachment.getFileId()); fileRequest.setFolder(DefaultRepositoryDir.getFunctionalCaseDir(request.getProjectId(), request.getCaseId()) + "/" + attachment.getFileId());
@ -315,7 +315,7 @@ public class FunctionalCaseAttachmentService {
List<FunctionalCaseAttachment> caseAttachments = functionalCaseAttachmentMapper.selectByExample(example); List<FunctionalCaseAttachment> caseAttachments = functionalCaseAttachmentMapper.selectByExample(example);
byte[] bytes = null; byte[] bytes = null;
if (CollectionUtils.isNotEmpty(caseAttachments)) { if (CollectionUtils.isNotEmpty(caseAttachments)) {
FunctionalCaseAttachment attachment = caseAttachments.get(0); FunctionalCaseAttachment attachment = caseAttachments.getFirst();
FileRequest fileRequest = new FileRequest(); FileRequest fileRequest = new FileRequest();
fileRequest.setFileName(attachment.getFileName()); fileRequest.setFileName(attachment.getFileName());
fileRequest.setFolder(DefaultRepositoryDir.getFunctionalCaseDir(request.getProjectId(), request.getCaseId()) + "/" + attachment.getFileId()); fileRequest.setFolder(DefaultRepositoryDir.getFunctionalCaseDir(request.getProjectId(), request.getCaseId()) + "/" + attachment.getFileId());
@ -334,7 +334,7 @@ public class FunctionalCaseAttachmentService {
example.createCriteria().andFileIdEqualTo(request.getFileId()).andCaseIdEqualTo(request.getCaseId()); example.createCriteria().andFileIdEqualTo(request.getFileId()).andCaseIdEqualTo(request.getCaseId());
List<FunctionalCaseAttachment> caseAttachments = functionalCaseAttachmentMapper.selectByExample(example); List<FunctionalCaseAttachment> caseAttachments = functionalCaseAttachmentMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(caseAttachments)) { if (CollectionUtils.isNotEmpty(caseAttachments)) {
return caseAttachments.get(0); return caseAttachments.getFirst();
} }
return new FunctionalCaseAttachment(); return new FunctionalCaseAttachment();
} }
@ -460,7 +460,7 @@ public class FunctionalCaseAttachmentService {
if (CollectionUtils.isEmpty(folderFileNames)) { if (CollectionUtils.isEmpty(folderFileNames)) {
return null; return null;
} }
String[] pathSplit = folderFileNames.get(0).split("/"); String[] pathSplit = folderFileNames.getFirst().split("/");
return pathSplit[pathSplit.length - 1]; return pathSplit[pathSplit.length - 1];
} catch (Exception e) { } catch (Exception e) {
@ -533,7 +533,7 @@ public class FunctionalCaseAttachmentService {
bytes = getPreviewImg(fileName, fileId, compressed); bytes = getPreviewImg(fileName, fileId, compressed);
} else { } else {
//在正式目录获取 //在正式目录获取
FunctionalCaseAttachment attachment = caseAttachments.get(0); FunctionalCaseAttachment attachment = caseAttachments.getFirst();
fileName = attachment.getFileName(); fileName = attachment.getFileName();
FileRequest fileRequest = new FileRequest(); FileRequest fileRequest = new FileRequest();
fileRequest.setFileName(attachment.getFileName()); fileRequest.setFileName(attachment.getFileName());

View File

@ -60,7 +60,7 @@ public class FunctionalCaseCustomFieldService {
example.createCriteria().andCaseIdEqualTo(caseId).andFieldIdEqualTo(fieldId); example.createCriteria().andCaseIdEqualTo(caseId).andFieldIdEqualTo(fieldId);
List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(example); List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(functionalCaseCustomFields)) { if (CollectionUtils.isNotEmpty(functionalCaseCustomFields)) {
return functionalCaseCustomFields.get(0); return functionalCaseCustomFields.getFirst();
} }
return null; return null;
} }

View File

@ -82,7 +82,7 @@ public class FunctionalCaseDemandService {
if (functionalCaseDemandMap.containsKey(demand.getParent())) { if (functionalCaseDemandMap.containsKey(demand.getParent())) {
FunctionalDemandDTO functionalDemandDTO = new FunctionalDemandDTO(); FunctionalDemandDTO functionalDemandDTO = new FunctionalDemandDTO();
BeanUtils.copyBean(functionalDemandDTO, demand); BeanUtils.copyBean(functionalDemandDTO, demand);
functionalCaseDemandMap.get(demand.getParent()).stream().filter(t -> StringUtils.equalsIgnoreCase(t.getDemandPlatform(), demand.getDemandPlatform())).toList().get(0).addChild(functionalDemandDTO); functionalCaseDemandMap.get(demand.getParent()).stream().filter(t -> StringUtils.equalsIgnoreCase(t.getDemandPlatform(), demand.getDemandPlatform())).toList().getFirst().addChild(functionalDemandDTO);
resetMap(demand, functionalCaseDemandMap, functionalDemandDTO); resetMap(demand, functionalCaseDemandMap, functionalDemandDTO);
} else { } else {
notMatchedList.add(demand); notMatchedList.add(demand);
@ -196,7 +196,7 @@ public class FunctionalCaseDemandService {
if (functionalCaseDemand == null) { if (functionalCaseDemand == null) {
throw new MSException(Translator.get("case.demand.not.exist")); throw new MSException(Translator.get("case.demand.not.exist"));
} }
dealWithDemand(request.getDemandList().get(0), functionalCaseDemand); dealWithDemand(request.getDemandList().getFirst(), functionalCaseDemand);
functionalCaseDemand.setCreateTime(null); functionalCaseDemand.setCreateTime(null);
functionalCaseDemand.setCreateUser(null); functionalCaseDemand.setCreateUser(null);
functionalCaseDemand.setUpdateUser(userId); functionalCaseDemand.setUpdateUser(userId);

View File

@ -252,7 +252,7 @@ public class FunctionalCaseService {
private static void copyFile(FunctionalCaseAddRequest request, String caseId, String saveAttachmentFileId, Map<String, List<FunctionalCaseAttachment>> oldFileMap, FunctionalCaseAttachmentDTO functionalCaseAttachmentDTO, FileRepository defaultRepository) { private static void copyFile(FunctionalCaseAddRequest request, String caseId, String saveAttachmentFileId, Map<String, List<FunctionalCaseAttachment>> oldFileMap, FunctionalCaseAttachmentDTO functionalCaseAttachmentDTO, FileRepository defaultRepository) {
List<FunctionalCaseAttachment> oldFunctionalCaseAttachments = oldFileMap.get(saveAttachmentFileId); List<FunctionalCaseAttachment> oldFunctionalCaseAttachments = oldFileMap.get(saveAttachmentFileId);
if (CollectionUtils.isNotEmpty(oldFunctionalCaseAttachments)) { if (CollectionUtils.isNotEmpty(oldFunctionalCaseAttachments)) {
FunctionalCaseAttachment functionalCaseAttachment = oldFunctionalCaseAttachments.get(0); FunctionalCaseAttachment functionalCaseAttachment = oldFunctionalCaseAttachments.getFirst();
// 复制文件 // 复制文件
FileCopyRequest fileCopyRequest = new FileCopyRequest(); FileCopyRequest fileCopyRequest = new FileCopyRequest();
fileCopyRequest.setCopyFolder(DefaultRepositoryDir.getFunctionalCaseDir(request.getProjectId(), functionalCaseAttachment.getCaseId()) + "/" + saveAttachmentFileId); fileCopyRequest.setCopyFolder(DefaultRepositoryDir.getFunctionalCaseDir(request.getProjectId(), functionalCaseAttachment.getCaseId()) + "/" + saveAttachmentFileId);
@ -362,7 +362,7 @@ public class FunctionalCaseService {
List<ProjectVersion> versions = extBaseProjectVersionMapper.getVersionByIds(List.of(functionalCaseDetailDTO.getVersionId())); List<ProjectVersion> versions = extBaseProjectVersionMapper.getVersionByIds(List.of(functionalCaseDetailDTO.getVersionId()));
if (CollectionUtils.isNotEmpty(versions)) { if (CollectionUtils.isNotEmpty(versions)) {
functionalCaseDetailDTO.setVersionName(versions.get(0).getName()); functionalCaseDetailDTO.setVersionName(versions.getFirst().getName());
} }
@ -483,7 +483,7 @@ public class FunctionalCaseService {
if (CollectionUtils.isEmpty(functionalCases)) { if (CollectionUtils.isEmpty(functionalCases)) {
throw new MSException(CaseManagementResultCode.FUNCTIONAL_CASE_NOT_FOUND); throw new MSException(CaseManagementResultCode.FUNCTIONAL_CASE_NOT_FOUND);
} }
return functionalCases.get(0); return functionalCases.getFirst();
} }
@ -1061,7 +1061,7 @@ public class FunctionalCaseService {
example.createCriteria().andNumEqualTo(Long.valueOf(num)).andProjectIdEqualTo(projectId).andDeletedEqualTo(false); example.createCriteria().andNumEqualTo(Long.valueOf(num)).andProjectIdEqualTo(projectId).andDeletedEqualTo(false);
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(example); List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(functionalCases)) { if (CollectionUtils.isNotEmpty(functionalCases)) {
return functionalCases.get(0).getId(); return functionalCases.getFirst().getId();
} }
return null; return null;
} }
@ -1343,8 +1343,8 @@ public class FunctionalCaseService {
} }
private void batchHandImportUpdateLog(FunctionalCaseHistoryLogDTO newData, Map<String, List<FunctionalCase>> collect, Map<String, List<FunctionalCaseBlob>> blobsCollect, Map<String, List<FunctionalCaseCustomField>> customFieldMap, List<LogDTO> logDTOS, SessionUser user) { private void batchHandImportUpdateLog(FunctionalCaseHistoryLogDTO newData, Map<String, List<FunctionalCase>> collect, Map<String, List<FunctionalCaseBlob>> blobsCollect, Map<String, List<FunctionalCaseCustomField>> customFieldMap, List<LogDTO> logDTOS, SessionUser user) {
FunctionalCase oldCase = collect.get(newData.getFunctionalCase().getId()).get(0); FunctionalCase oldCase = collect.get(newData.getFunctionalCase().getId()).getFirst();
FunctionalCaseBlob oldBlod = blobsCollect.get(newData.getFunctionalCase().getId()).get(0); FunctionalCaseBlob oldBlod = blobsCollect.get(newData.getFunctionalCase().getId()).getFirst();
List<FunctionalCaseCustomField> oldCustomFields = customFieldMap.get(newData.getFunctionalCase().getId()); List<FunctionalCaseCustomField> oldCustomFields = customFieldMap.get(newData.getFunctionalCase().getId());
batchSaveImportData(newData, new FunctionalCaseHistoryLogDTO(oldCase, oldBlod, oldCustomFields, new ArrayList<>(), new ArrayList<>()), user, OperationLogType.IMPORT.name(), OperationLogModule.FUNCTIONAL_CASE, logDTOS); batchSaveImportData(newData, new FunctionalCaseHistoryLogDTO(oldCase, oldBlod, oldCustomFields, new ArrayList<>(), new ArrayList<>()), user, OperationLogType.IMPORT.name(), OperationLogModule.FUNCTIONAL_CASE, logDTOS);
} }
@ -1377,7 +1377,7 @@ public class FunctionalCaseService {
private void parseUpdateDataToModule(FunctionalCaseExcelData functionalCaseExcelData, FunctionalCaseImportRequest request, String userId, Map<String, String> caseModulePathMap, TemplateDTO defaultTemplateDTO, FunctionalCaseMapper caseMapper, FunctionalCaseBlobMapper caseBlobMapper, private void parseUpdateDataToModule(FunctionalCaseExcelData functionalCaseExcelData, FunctionalCaseImportRequest request, String userId, Map<String, String> caseModulePathMap, TemplateDTO defaultTemplateDTO, FunctionalCaseMapper caseMapper, FunctionalCaseBlobMapper caseBlobMapper,
FunctionalCaseCustomFieldMapper customFieldMapper, Map<String, TemplateCustomFieldDTO> customFieldsMap, Map<String, List<FunctionalCase>> collect, List<FunctionalCaseHistoryLogDTO> historyLogDTOS) { FunctionalCaseCustomFieldMapper customFieldMapper, Map<String, TemplateCustomFieldDTO> customFieldsMap, Map<String, List<FunctionalCase>> collect, List<FunctionalCaseHistoryLogDTO> historyLogDTOS) {
//用例表 //用例表
FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).get(0); FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).getFirst();
functionalCase.setName(functionalCaseExcelData.getName()); functionalCase.setName(functionalCaseExcelData.getName());
functionalCase.setModuleId(caseModulePathMap.get(functionalCaseExcelData.getModule())); functionalCase.setModuleId(caseModulePathMap.get(functionalCaseExcelData.getModule()));
@ -1409,9 +1409,9 @@ public class FunctionalCaseService {
} }
private void addStatusIds(List<ProjectApplication> projectApplications, List<String> caseIds, Map<String, List<FunctionalCase>> collect, Map<String, List<FunctionalCaseBlob>> blobsCollect, FunctionalCaseExcelData functionalCaseExcelData) { private void addStatusIds(List<ProjectApplication> projectApplications, List<String> caseIds, Map<String, List<FunctionalCase>> collect, Map<String, List<FunctionalCaseBlob>> blobsCollect, FunctionalCaseExcelData functionalCaseExcelData) {
FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).get(0); FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).getFirst();
if (CollectionUtils.isNotEmpty(projectApplications) && Boolean.valueOf(projectApplications.get(0).getTypeValue())) { if (CollectionUtils.isNotEmpty(projectApplications) && Boolean.valueOf(projectApplications.getFirst().getTypeValue())) {
FunctionalCaseBlob blob = blobsCollect.get(functionalCaseExcelData.getNum()).get(0); FunctionalCaseBlob blob = blobsCollect.get(functionalCaseExcelData.getNum()).getFirst();
if (!StringUtils.equals(functionalCase.getName(), functionalCaseExcelData.getName()) if (!StringUtils.equals(functionalCase.getName(), functionalCaseExcelData.getName())
|| !StringUtils.equals(new String(blob.getSteps(), StandardCharsets.UTF_8), StringUtils.defaultIfBlank(functionalCaseExcelData.getSteps(), StringUtils.EMPTY)) || !StringUtils.equals(new String(blob.getSteps(), StandardCharsets.UTF_8), StringUtils.defaultIfBlank(functionalCaseExcelData.getSteps(), StringUtils.EMPTY))
|| !StringUtils.equals(new String(blob.getTextDescription(), StandardCharsets.UTF_8), StringUtils.defaultIfBlank(functionalCaseExcelData.getTextDescription(), StringUtils.EMPTY)) || !StringUtils.equals(new String(blob.getTextDescription(), StandardCharsets.UTF_8), StringUtils.defaultIfBlank(functionalCaseExcelData.getTextDescription(), StringUtils.EMPTY))

View File

@ -135,7 +135,7 @@ public class ReviewFunctionalCaseService {
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(request.getReviewId()).andCaseIdEqualTo(request.getCaseId()); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(request.getReviewId()).andCaseIdEqualTo(request.getCaseId());
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
String status = caseReviewFunctionalCases.get(0).getStatus(); String status = caseReviewFunctionalCases.getFirst().getStatus();
if (StringUtils.equals(request.getReviewPassRule(), CaseReviewPassRule.SINGLE.toString())) { if (StringUtils.equals(request.getReviewPassRule(), CaseReviewPassRule.SINGLE.toString())) {
if (StringUtils.equalsIgnoreCase(request.getStatus(), FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()) || isAdmin) { if (StringUtils.equalsIgnoreCase(request.getStatus(), FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()) || isAdmin) {
functionalCaseStatus = status; functionalCaseStatus = status;
@ -151,10 +151,10 @@ public class ReviewFunctionalCaseService {
AtomicInteger unPassCount = new AtomicInteger(); AtomicInteger unPassCount = new AtomicInteger();
hasReviewedUserMap.forEach((k, v) -> { hasReviewedUserMap.forEach((k, v) -> {
List<CaseReviewHistory> list = v.stream().sorted(Comparator.comparing(CaseReviewHistory::getCreateTime).reversed()).toList(); List<CaseReviewHistory> list = v.stream().sorted(Comparator.comparing(CaseReviewHistory::getCreateTime).reversed()).toList();
if (StringUtils.equalsIgnoreCase(list.get(0).getStatus(), FunctionalCaseReviewStatus.PASS.toString())) { if (StringUtils.equalsIgnoreCase(list.getFirst().getStatus(), FunctionalCaseReviewStatus.PASS.toString())) {
passCount.set(passCount.get() + 1); passCount.set(passCount.get() + 1);
} }
if (StringUtils.equalsIgnoreCase(list.get(0).getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())) { if (StringUtils.equalsIgnoreCase(list.getFirst().getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())) {
unPassCount.set(unPassCount.get() + 1); unPassCount.set(unPassCount.get() + 1);
} }
}); });

View File

@ -87,7 +87,7 @@ public class CaseReviewControllerTests extends BaseTest {
checkLog(caseReview.getId(), OperationLogType.ADD); checkLog(caseReview.getId(), OperationLogType.ADD);
List<CaseReview> caseReviews = getCaseReviews("创建评审1"); List<CaseReview> caseReviews = getCaseReviews("创建评审1");
Assertions.assertEquals(1, caseReviews.size()); Assertions.assertEquals(1, caseReviews.size());
String caseReviewId = caseReviews.get(0).getId(); String caseReviewId = caseReviews.getFirst().getId();
CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample(); CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample();
caseReviewUserExample.createCriteria().andReviewIdEqualTo(caseReviewId); caseReviewUserExample.createCriteria().andReviewIdEqualTo(caseReviewId);
List<CaseReviewUser> caseReviewUsers = caseReviewUserMapper.selectByExample(caseReviewUserExample); List<CaseReviewUser> caseReviewUsers = caseReviewUserMapper.selectByExample(caseReviewUserExample);
@ -131,7 +131,7 @@ public class CaseReviewControllerTests extends BaseTest {
list = caseReviews.stream().map(CaseReview::getId).distinct().toList(); list = caseReviews.stream().map(CaseReview::getId).distinct().toList();
Assertions.assertEquals(1, list.size()); Assertions.assertEquals(1, list.size());
caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviews.get(0).getId()); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviews.getFirst().getId());
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
FunctionalCaseExample functionalCaseExample = new FunctionalCaseExample(); FunctionalCaseExample functionalCaseExample = new FunctionalCaseExample();
functionalCaseExample.createCriteria().andProjectIdEqualTo(baseAssociateCaseRequest.getProjectId()); functionalCaseExample.createCriteria().andProjectIdEqualTo(baseAssociateCaseRequest.getProjectId());
@ -194,7 +194,7 @@ public class CaseReviewControllerTests extends BaseTest {
this.requestPostWithOk(ADD_CASE_REVIEW, caseReviewRequest); this.requestPostWithOk(ADD_CASE_REVIEW, caseReviewRequest);
List<CaseReview> caseReviews = getCaseReviews("创建评审2"); List<CaseReview> caseReviews = getCaseReviews("创建评审2");
Assertions.assertEquals(1, caseReviews.size()); Assertions.assertEquals(1, caseReviews.size());
String caseReviewId = caseReviews.get(0).getId(); String caseReviewId = caseReviews.getFirst().getId();
CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample(); CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample();
caseReviewUserExample.createCriteria().andReviewIdEqualTo(caseReviewId); caseReviewUserExample.createCriteria().andReviewIdEqualTo(caseReviewId);
List<CaseReviewUser> caseReviewUsers = caseReviewUserMapper.selectByExample(caseReviewUserExample); List<CaseReviewUser> caseReviewUsers = caseReviewUserMapper.selectByExample(caseReviewUserExample);
@ -213,8 +213,8 @@ public class CaseReviewControllerTests extends BaseTest {
this.requestPostWithOk(ADD_CASE_REVIEW, caseReviewRequest); this.requestPostWithOk(ADD_CASE_REVIEW, caseReviewRequest);
List<CaseReview> caseReviews = getCaseReviews("创建评审3"); List<CaseReview> caseReviews = getCaseReviews("创建评审3");
Assertions.assertEquals(1, caseReviews.size()); Assertions.assertEquals(1, caseReviews.size());
String caseReviewId = caseReviews.get(0).getId(); String caseReviewId = caseReviews.getFirst().getId();
Assertions.assertNotNull(caseReviews.get(0).getTags()); Assertions.assertNotNull(caseReviews.getFirst().getTags());
CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample(); CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample();
caseReviewUserExample.createCriteria().andReviewIdEqualTo(caseReviewId); caseReviewUserExample.createCriteria().andReviewIdEqualTo(caseReviewId);
List<CaseReviewUser> caseReviewUsers = caseReviewUserMapper.selectByExample(caseReviewUserExample); List<CaseReviewUser> caseReviewUsers = caseReviewUserMapper.selectByExample(caseReviewUserExample);
@ -245,7 +245,7 @@ public class CaseReviewControllerTests extends BaseTest {
@Order(5) @Order(5)
public void followCaseReview() throws Exception { public void followCaseReview() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建评审1"); List<CaseReview> caseReviews = getCaseReviews("创建评审1");
CaseReview caseReview = caseReviews.get(0); CaseReview caseReview = caseReviews.getFirst();
CaseReviewFollowerRequest caseReviewFollowerRequest = new CaseReviewFollowerRequest(); CaseReviewFollowerRequest caseReviewFollowerRequest = new CaseReviewFollowerRequest();
caseReviewFollowerRequest.setCaseReviewId(caseReview.getId()); caseReviewFollowerRequest.setCaseReviewId(caseReview.getId());
caseReviewFollowerRequest.setUserId("admin"); caseReviewFollowerRequest.setUserId("admin");
@ -276,14 +276,14 @@ public class CaseReviewControllerTests extends BaseTest {
@Order(7) @Order(7)
public void editCaseReviewSuccess() throws Exception { public void editCaseReviewSuccess() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建评审1"); List<CaseReview> caseReviews = getCaseReviews("创建评审1");
CaseReview caseReview = caseReviews.get(0); CaseReview caseReview = caseReviews.getFirst();
CaseReviewRequest caseReviewRequest = getCaseReviewAddRequest("创建评审更新1", CaseReviewPassRule.SINGLE.toString(), null, true, true, caseReview.getId()); CaseReviewRequest caseReviewRequest = getCaseReviewAddRequest("创建评审更新1", CaseReviewPassRule.SINGLE.toString(), null, true, true, caseReview.getId());
this.requestPostWithOk(EDIT_CASE_REVIEW, caseReviewRequest); this.requestPostWithOk(EDIT_CASE_REVIEW, caseReviewRequest);
List<CaseReview> updateCaseReviews = getCaseReviews("创建评审更新1"); List<CaseReview> updateCaseReviews = getCaseReviews("创建评审更新1");
Assertions.assertEquals(1, updateCaseReviews.size()); Assertions.assertEquals(1, updateCaseReviews.size());
List<CaseReview> caseReviews2 = getCaseReviews("创建评审2"); List<CaseReview> caseReviews2 = getCaseReviews("创建评审2");
CaseReview caseReview2 = caseReviews2.get(0); CaseReview caseReview2 = caseReviews2.getFirst();
CaseReviewRequest caseReviewRequest2 = getCaseReviewAddRequest("创建评审更新2", CaseReviewPassRule.SINGLE.toString(), null, false, true, caseReview2.getId()); CaseReviewRequest caseReviewRequest2 = getCaseReviewAddRequest("创建评审更新2", CaseReviewPassRule.SINGLE.toString(), null, false, true, caseReview2.getId());
this.requestPostWithOk(EDIT_CASE_REVIEW, caseReviewRequest2); this.requestPostWithOk(EDIT_CASE_REVIEW, caseReviewRequest2);
List<CaseReview> updateCaseReviews2 = getCaseReviews("创建评审更新2"); List<CaseReview> updateCaseReviews2 = getCaseReviews("创建评审更新2");
@ -299,7 +299,7 @@ public class CaseReviewControllerTests extends BaseTest {
caseReviewRequest = getCaseReviewAddRequest("创建评审更新1", CaseReviewPassRule.SINGLE.toString(), null, true, true, "XXX"); caseReviewRequest = getCaseReviewAddRequest("创建评审更新1", CaseReviewPassRule.SINGLE.toString(), null, true, true, "XXX");
this.requestPost(EDIT_CASE_REVIEW, caseReviewRequest).andExpect(status().is5xxServerError()); this.requestPost(EDIT_CASE_REVIEW, caseReviewRequest).andExpect(status().is5xxServerError());
List<CaseReview> caseReviews = getCaseReviews("创建评审1"); List<CaseReview> caseReviews = getCaseReviews("创建评审1");
CaseReview caseReview = caseReviews.get(0); CaseReview caseReview = caseReviews.getFirst();
CaseReviewRequest caseReviewRequestWidthStartTime = getCaseReviewAddRequest("创建评审更新1", CaseReviewPassRule.SINGLE.toString(), caseReview.getId(), true, true, null); CaseReviewRequest caseReviewRequestWidthStartTime = getCaseReviewAddRequest("创建评审更新1", CaseReviewPassRule.SINGLE.toString(), caseReview.getId(), true, true, null);
caseReviewRequestWidthStartTime.setStartTime(1678188043000L); caseReviewRequestWidthStartTime.setStartTime(1678188043000L);
caseReviewRequestWidthStartTime.setEndTime(1678188103000L); caseReviewRequestWidthStartTime.setEndTime(1678188103000L);
@ -324,7 +324,7 @@ public class CaseReviewControllerTests extends BaseTest {
public void associateCaseSuccess() throws Exception { public void associateCaseSuccess() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1"); List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
Assertions.assertEquals(1, caseReviews.size()); Assertions.assertEquals(1, caseReviews.size());
String caseReviewId = caseReviews.get(0).getId(); String caseReviewId = caseReviews.getFirst().getId();
CaseReviewAssociateRequest caseReviewAssociateRequest = new CaseReviewAssociateRequest(); CaseReviewAssociateRequest caseReviewAssociateRequest = new CaseReviewAssociateRequest();
caseReviewAssociateRequest.setProjectId(projectId); caseReviewAssociateRequest.setProjectId(projectId);
caseReviewAssociateRequest.setReviewId(caseReviewId); caseReviewAssociateRequest.setReviewId(caseReviewId);
@ -350,7 +350,7 @@ public class CaseReviewControllerTests extends BaseTest {
Assertions.assertTrue(userIdList.contains("gyq_review_test")); Assertions.assertTrue(userIdList.contains("gyq_review_test"));
Assertions.assertTrue(userIdList.contains("gyq_review_test2")); Assertions.assertTrue(userIdList.contains("gyq_review_test2"));
List<CaseReview> caseReviews2 = getCaseReviews("创建评审更新1"); List<CaseReview> caseReviews2 = getCaseReviews("创建评审更新1");
Assertions.assertTrue( caseReviews.get(0).getCaseCount()<caseReviews2.get(0).getCaseCount()); Assertions.assertTrue( caseReviews.getFirst().getCaseCount()<caseReviews2.getFirst().getCaseCount());
} }
@Test @Test
@ -371,7 +371,7 @@ public class CaseReviewControllerTests extends BaseTest {
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1"); List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
caseReviewAssociateRequest = new CaseReviewAssociateRequest(); caseReviewAssociateRequest = new CaseReviewAssociateRequest();
caseReviewAssociateRequest.setProjectId(projectId); caseReviewAssociateRequest.setProjectId(projectId);
caseReviewAssociateRequest.setReviewId(caseReviews.get(0).getId()); caseReviewAssociateRequest.setReviewId(caseReviews.getFirst().getId());
baseAssociateCaseRequest = new BaseAssociateCaseRequest(); baseAssociateCaseRequest = new BaseAssociateCaseRequest();
baseAssociateCaseRequest.setProjectId(projectId); baseAssociateCaseRequest.setProjectId(projectId);
baseAssociateCaseRequest.setSelectAll(false); baseAssociateCaseRequest.setSelectAll(false);
@ -385,7 +385,7 @@ public class CaseReviewControllerTests extends BaseTest {
caseReviewAssociateRequest = new CaseReviewAssociateRequest(); caseReviewAssociateRequest = new CaseReviewAssociateRequest();
caseReviewAssociateRequest.setProjectId(projectId); caseReviewAssociateRequest.setProjectId(projectId);
caseReviewAssociateRequest.setReviewId(caseReviews.get(0).getId()); caseReviewAssociateRequest.setReviewId(caseReviews.getFirst().getId());
baseAssociateCaseRequest = new BaseAssociateCaseRequest(); baseAssociateCaseRequest = new BaseAssociateCaseRequest();
baseAssociateCaseRequest.setProjectId("project-gyq-case-review-testYY"); baseAssociateCaseRequest.setProjectId("project-gyq-case-review-testYY");
baseAssociateCaseRequest.setSelectAll(true); baseAssociateCaseRequest.setSelectAll(true);
@ -453,7 +453,7 @@ public class CaseReviewControllerTests extends BaseTest {
Assertions.assertTrue(moduleCount.containsKey("all")); Assertions.assertTrue(moduleCount.containsKey("all"));
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviews.get(0).getId()); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviews.getFirst().getId());
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
Map<String, CaseReviewFunctionalCase> caseReviewFunctionalCaseMap = caseReviewFunctionalCases.stream().collect(Collectors.toMap(CaseReviewFunctionalCase::getCaseId, t -> t)); Map<String, CaseReviewFunctionalCase> caseReviewFunctionalCaseMap = caseReviewFunctionalCases.stream().collect(Collectors.toMap(CaseReviewFunctionalCase::getCaseId, t -> t));
caseReviewFunctionalCaseMap.forEach((k, v) -> { caseReviewFunctionalCaseMap.forEach((k, v) -> {
@ -491,11 +491,11 @@ public class CaseReviewControllerTests extends BaseTest {
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
List<CaseReviewDTO> caseReviewDTOS = JSON.parseArray(JSON.toJSONString(pageData.getList()), CaseReviewDTO.class); List<CaseReviewDTO> caseReviewDTOS = JSON.parseArray(JSON.toJSONString(pageData.getList()), CaseReviewDTO.class);
List<CaseReviewDTO> caseReviewOne = caseReviewDTOS.stream().filter(t -> StringUtils.equals(t.getName(), "创建评审更新1")).toList(); List<CaseReviewDTO> caseReviewOne = caseReviewDTOS.stream().filter(t -> StringUtils.equals(t.getName(), "创建评审更新1")).toList();
Assertions.assertTrue(caseReviewOne.get(0).getPassCount() > 0); Assertions.assertTrue(caseReviewOne.getFirst().getPassCount() > 0);
Assertions.assertTrue(caseReviewOne.get(0).getUnPassCount() > 0); Assertions.assertTrue(caseReviewOne.getFirst().getUnPassCount() > 0);
Assertions.assertTrue(caseReviewOne.get(0).getUnderReviewedCount() > 0); Assertions.assertTrue(caseReviewOne.getFirst().getUnderReviewedCount() > 0);
Assertions.assertTrue(caseReviewOne.get(0).getReReviewedCount() > 0); Assertions.assertTrue(caseReviewOne.getFirst().getReReviewedCount() > 0);
Assertions.assertTrue(caseReviewOne.get(0).getReviewedCount() > 0); Assertions.assertTrue(caseReviewOne.getFirst().getReviewedCount() > 0);
request = new CaseReviewPageRequest(); request = new CaseReviewPageRequest();
filters = new HashMap<>(); filters = new HashMap<>();
@ -551,26 +551,26 @@ public class CaseReviewControllerTests extends BaseTest {
public void testPos() throws Exception { public void testPos() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1"); List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
List<CaseReview> caseReviews2 = getCaseReviews("创建评审更新2"); List<CaseReview> caseReviews2 = getCaseReviews("创建评审更新2");
Long pos = caseReviews.get(0).getPos(); Long pos = caseReviews.getFirst().getPos();
Long pos2 = caseReviews2.get(0).getPos(); Long pos2 = caseReviews2.getFirst().getPos();
PosRequest posRequest = new PosRequest(); PosRequest posRequest = new PosRequest();
posRequest.setProjectId(projectId); posRequest.setProjectId(projectId);
posRequest.setTargetId(caseReviews.get(0).getId()); posRequest.setTargetId(caseReviews.getFirst().getId());
posRequest.setMoveId(caseReviews2.get(0).getId()); posRequest.setMoveId(caseReviews2.getFirst().getId());
posRequest.setMoveMode("AFTER"); posRequest.setMoveMode("AFTER");
this.requestPostWithOkAndReturn(EDIT_POS_CASE_REVIEW_URL, posRequest); this.requestPostWithOkAndReturn(EDIT_POS_CASE_REVIEW_URL, posRequest);
caseReviews = getCaseReviews("创建评审更新1"); caseReviews = getCaseReviews("创建评审更新1");
caseReviews2 = getCaseReviews("创建评审更新2"); caseReviews2 = getCaseReviews("创建评审更新2");
Long pos3 = caseReviews.get(0).getPos(); Long pos3 = caseReviews.getFirst().getPos();
Long pos4 = caseReviews2.get(0).getPos(); Long pos4 = caseReviews2.getFirst().getPos();
Assertions.assertTrue(Objects.equals(pos, pos3)); Assertions.assertTrue(Objects.equals(pos, pos3));
Assertions.assertTrue(pos2 > pos4); Assertions.assertTrue(pos2 > pos4);
posRequest.setMoveMode("BEFORE"); posRequest.setMoveMode("BEFORE");
this.requestPostWithOkAndReturn(EDIT_POS_CASE_REVIEW_URL, posRequest); this.requestPostWithOkAndReturn(EDIT_POS_CASE_REVIEW_URL, posRequest);
caseReviews = getCaseReviews("创建评审更新1"); caseReviews = getCaseReviews("创建评审更新1");
caseReviews2 = getCaseReviews("创建评审更新2"); caseReviews2 = getCaseReviews("创建评审更新2");
Long pos5 = caseReviews.get(0).getPos(); Long pos5 = caseReviews.getFirst().getPos();
Long pos6 = caseReviews2.get(0).getPos(); Long pos6 = caseReviews2.getFirst().getPos();
Assertions.assertTrue(Objects.equals(pos5, pos3)); Assertions.assertTrue(Objects.equals(pos5, pos3));
Assertions.assertTrue(pos6 > pos4); Assertions.assertTrue(pos6 > pos4);
} }
@ -579,7 +579,7 @@ public class CaseReviewControllerTests extends BaseTest {
@Order(14) @Order(14)
public void testFunctionalCaseDetail() throws Exception { public void testFunctionalCaseDetail() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1"); List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
String id = caseReviews.get(0).getId(); String id = caseReviews.getFirst().getId();
assertErrorCode(this.requestGet(DETAIL_CASE_REVIEW + "ERROR_TEST_FUNCTIONAL_CASE_ID"), CaseManagementResultCode.CASE_REVIEW_NOT_FOUND); assertErrorCode(this.requestGet(DETAIL_CASE_REVIEW + "ERROR_TEST_FUNCTIONAL_CASE_ID"), CaseManagementResultCode.CASE_REVIEW_NOT_FOUND);
MvcResult mvcResult = this.requestGetWithOkAndReturn(DETAIL_CASE_REVIEW + id); MvcResult mvcResult = this.requestGetWithOkAndReturn(DETAIL_CASE_REVIEW + id);
// 获取返回值 // 获取返回值
@ -593,17 +593,17 @@ public class CaseReviewControllerTests extends BaseTest {
@Order(15) @Order(15)
public void testBatchMove() throws Exception { public void testBatchMove() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1"); List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
String moduleId = caseReviews.get(0).getModuleId(); String moduleId = caseReviews.getFirst().getModuleId();
CaseReviewBatchRequest request = new CaseReviewBatchRequest(); CaseReviewBatchRequest request = new CaseReviewBatchRequest();
request.setProjectId(projectId); request.setProjectId(projectId);
request.setMoveModuleId("CASE_REVIEW_REAL_MODULE_ID2"); request.setMoveModuleId("CASE_REVIEW_REAL_MODULE_ID2");
request.setSelectAll(false); request.setSelectAll(false);
this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request); this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request);
request.setSelectAll(true); request.setSelectAll(true);
request.setExcludeIds(List.of(caseReviews.get(0).getId())); request.setExcludeIds(List.of(caseReviews.getFirst().getId()));
this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request); this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request);
caseReviews = getCaseReviews("创建评审更新1"); caseReviews = getCaseReviews("创建评审更新1");
String moduleIdNew = caseReviews.get(0).getModuleId(); String moduleIdNew = caseReviews.getFirst().getModuleId();
Assertions.assertTrue(StringUtils.equals(moduleId, moduleIdNew)); Assertions.assertTrue(StringUtils.equals(moduleId, moduleIdNew));
request = new CaseReviewBatchRequest(); request = new CaseReviewBatchRequest();
request.setProjectId(projectId); request.setProjectId(projectId);
@ -611,7 +611,7 @@ public class CaseReviewControllerTests extends BaseTest {
request.setSelectAll(false); request.setSelectAll(false);
this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request); this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request);
caseReviews = getCaseReviews("创建评审更新1"); caseReviews = getCaseReviews("创建评审更新1");
String moduleIdNewOne = caseReviews.get(0).getModuleId(); String moduleIdNewOne = caseReviews.getFirst().getModuleId();
Assertions.assertTrue(StringUtils.equals(moduleIdNewOne, moduleIdNew)); Assertions.assertTrue(StringUtils.equals(moduleIdNewOne, moduleIdNew));
request.setMoveModuleId(null); request.setMoveModuleId(null);
request.setSelectAll(false); request.setSelectAll(false);
@ -622,7 +622,7 @@ public class CaseReviewControllerTests extends BaseTest {
@Order(16) @Order(16)
public void testDelete() throws Exception { public void testDelete() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建评审更新2"); List<CaseReview> caseReviews = getCaseReviews("创建评审更新2");
delCaseReview(caseReviews.get(0).getId()); delCaseReview(caseReviews.getFirst().getId());
delCaseReview("caseReviewIdX"); delCaseReview("caseReviewIdX");
} }
@ -633,7 +633,7 @@ public class CaseReviewControllerTests extends BaseTest {
public void testDisassociate() throws Exception { public void testDisassociate() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1"); List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
Assertions.assertEquals(1, caseReviews.size()); Assertions.assertEquals(1, caseReviews.size());
String caseReviewId = caseReviews.get(0).getId(); String caseReviewId = caseReviews.getFirst().getId();
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviewId).andCaseIdEqualTo("CASE_REVIEW_TEST_GYQ_ID6"); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviewId).andCaseIdEqualTo("CASE_REVIEW_TEST_GYQ_ID6");
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
@ -651,7 +651,7 @@ public class CaseReviewControllerTests extends BaseTest {
caseReviews = getCaseReviews("创建评审3"); caseReviews = getCaseReviews("创建评审3");
Assertions.assertEquals(1, caseReviews.size()); Assertions.assertEquals(1, caseReviews.size());
caseReviewId = caseReviews.get(0).getId(); caseReviewId = caseReviews.getFirst().getId();
CaseReviewAssociateRequest caseReviewAssociateRequest = new CaseReviewAssociateRequest(); CaseReviewAssociateRequest caseReviewAssociateRequest = new CaseReviewAssociateRequest();
caseReviewAssociateRequest.setProjectId(projectId); caseReviewAssociateRequest.setProjectId(projectId);
caseReviewAssociateRequest.setReviewId(caseReviewId); caseReviewAssociateRequest.setReviewId(caseReviewId);
@ -680,7 +680,7 @@ public class CaseReviewControllerTests extends BaseTest {
@Order(18) @Order(18)
public void testDisassociateFalse() throws Exception { public void testDisassociateFalse() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1"); List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
String caseReviewId = caseReviews.get(0).getId(); String caseReviewId = caseReviews.getFirst().getId();
mockMvc.perform(MockMvcRequestBuilders.get(DISASSOCIATE_CASE_REVIEW+caseReviewId+"/CASE_REVIEW_TEST_GYQ_IDXX").header(SessionConstants.HEADER_TOKEN, sessionId) mockMvc.perform(MockMvcRequestBuilders.get(DISASSOCIATE_CASE_REVIEW+caseReviewId+"/CASE_REVIEW_TEST_GYQ_IDXX").header(SessionConstants.HEADER_TOKEN, sessionId)
.header(SessionConstants.CSRF_TOKEN, csrfToken) .header(SessionConstants.CSRF_TOKEN, csrfToken)
.header(SessionConstants.CURRENT_PROJECT, projectId) .header(SessionConstants.CURRENT_PROJECT, projectId)

View File

@ -238,7 +238,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
@Order(7) @Order(7)
public void testPos() throws Exception { public void testPos() throws Exception {
List<CaseReviewFunctionalCase> caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1"); List<CaseReviewFunctionalCase> caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1");
CaseReviewFunctionalCase caseReviews = caseReviewList.get(0); CaseReviewFunctionalCase caseReviews = caseReviewList.getFirst();
CaseReviewFunctionalCase caseReviews2 = caseReviewList.get(1); CaseReviewFunctionalCase caseReviews2 = caseReviewList.get(1);
Long pos = caseReviews.getPos(); Long pos = caseReviews.getPos();
Long pos2 = caseReviews2.getPos(); Long pos2 = caseReviews2.getPos();
@ -251,7 +251,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_POS, posRequest); this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_POS, posRequest);
caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1"); caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1");
caseReviews = caseReviewList.get(1); caseReviews = caseReviewList.get(1);
caseReviews2 = caseReviewList.get(0); caseReviews2 = caseReviewList.getFirst();
Long pos3 = caseReviews.getPos(); Long pos3 = caseReviews.getPos();
Long pos4 = caseReviews2.getPos(); Long pos4 = caseReviews2.getPos();
Assertions.assertTrue(Objects.equals(pos, pos3)); Assertions.assertTrue(Objects.equals(pos, pos3));
@ -259,7 +259,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
posRequest.setMoveMode("BEFORE"); posRequest.setMoveMode("BEFORE");
this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_POS, posRequest); this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_POS, posRequest);
caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1"); caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1");
caseReviews = caseReviewList.get(0); caseReviews = caseReviewList.getFirst();
caseReviews2 = caseReviewList.get(1); caseReviews2 = caseReviewList.get(1);
Long pos5 = caseReviews.getPos(); Long pos5 = caseReviews.getPos();
Long pos6 = caseReviews2.getPos(); Long pos6 = caseReviews2.getPos();

View File

@ -435,7 +435,7 @@ public class FunctionalCaseCommentControllerTests {
FunctionalCaseCommentExample functionalCaseCommentExample = new FunctionalCaseCommentExample(); FunctionalCaseCommentExample functionalCaseCommentExample = new FunctionalCaseCommentExample();
functionalCaseCommentExample.createCriteria().andCaseIdEqualTo("xiaomeinvGTest").andNotifierEqualTo("default-project-member-user-guo;default-project-member-user-guo;default-project-member-user-guo-4;"); functionalCaseCommentExample.createCriteria().andCaseIdEqualTo("xiaomeinvGTest").andNotifierEqualTo("default-project-member-user-guo;default-project-member-user-guo;default-project-member-user-guo-4;");
List<FunctionalCaseComment> functionalCaseComments = functionalCaseCommentMapper.selectByExample(functionalCaseCommentExample); List<FunctionalCaseComment> functionalCaseComments = functionalCaseCommentMapper.selectByExample(functionalCaseCommentExample);
String id = functionalCaseComments.get(0).getId(); String id = functionalCaseComments.getFirst().getId();
Assertions.assertFalse(functionalCaseComments.isEmpty()); Assertions.assertFalse(functionalCaseComments.isEmpty());
delFunctionalCaseComment(id); delFunctionalCaseComment(id);
functionalCaseCommentExample = new FunctionalCaseCommentExample(); functionalCaseCommentExample = new FunctionalCaseCommentExample();
@ -517,7 +517,7 @@ public class FunctionalCaseCommentControllerTests {
FunctionalCaseCommentExample functionalCaseCommentExample = new FunctionalCaseCommentExample(); FunctionalCaseCommentExample functionalCaseCommentExample = new FunctionalCaseCommentExample();
functionalCaseCommentExample.createCriteria().andCaseIdEqualTo("xiaomeinvGTest"); functionalCaseCommentExample.createCriteria().andCaseIdEqualTo("xiaomeinvGTest");
List<FunctionalCaseComment> functionalCaseComments = functionalCaseCommentMapper.selectByExample(functionalCaseCommentExample); List<FunctionalCaseComment> functionalCaseComments = functionalCaseCommentMapper.selectByExample(functionalCaseCommentExample);
return functionalCaseComments.get(0); return functionalCaseComments.getFirst();
} }
} }

View File

@ -273,7 +273,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
functionalCaseDemandExample = new FunctionalCaseDemandExample(); functionalCaseDemandExample = new FunctionalCaseDemandExample();
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo("DEMAND_TEST_FUNCTIONAL_CASE_ID"); functionalCaseDemandExample.createCriteria().andCaseIdEqualTo("DEMAND_TEST_FUNCTIONAL_CASE_ID");
functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample); functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
Assertions.assertTrue(StringUtils.equals(functionalCaseDemands.get(0).getDemandName(), "手动加入2")); Assertions.assertTrue(StringUtils.equals(functionalCaseDemands.getFirst().getDemandName(), "手动加入2"));
} }
@Test @Test
@ -292,7 +292,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
functionalCaseDemandExample = new FunctionalCaseDemandExample(); functionalCaseDemandExample = new FunctionalCaseDemandExample();
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo("DEMAND_TEST_FUNCTIONAL_CASE_ID"); functionalCaseDemandExample.createCriteria().andCaseIdEqualTo("DEMAND_TEST_FUNCTIONAL_CASE_ID");
functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample); functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
Assertions.assertTrue(StringUtils.equals(functionalCaseDemands.get(0).getDemandName(), "手动加入2")); Assertions.assertTrue(StringUtils.equals(functionalCaseDemands.getFirst().getDemandName(), "手动加入2"));
} }
@Test @Test
@ -314,7 +314,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
functionalCaseDemandExample = new FunctionalCaseDemandExample(); functionalCaseDemandExample = new FunctionalCaseDemandExample();
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo("DEMAND_TEST_FUNCTIONAL_CASE_ID"); functionalCaseDemandExample.createCriteria().andCaseIdEqualTo("DEMAND_TEST_FUNCTIONAL_CASE_ID");
functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample); functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
Assertions.assertNotNull(functionalCaseDemands.get(0).getDemandId()); Assertions.assertNotNull(functionalCaseDemands.getFirst().getDemandId());
functionalCaseDemandRequest = new FunctionalCaseDemandRequest(); functionalCaseDemandRequest = new FunctionalCaseDemandRequest();
functionalCaseDemandRequest.setId("hehe"); functionalCaseDemandRequest.setId("hehe");
@ -344,7 +344,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
FunctionalCaseDemandExample functionalCaseDemandExample = new FunctionalCaseDemandExample(); FunctionalCaseDemandExample functionalCaseDemandExample = new FunctionalCaseDemandExample();
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo(caseId); functionalCaseDemandExample.createCriteria().andCaseIdEqualTo(caseId);
List<FunctionalCaseDemand> functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample); List<FunctionalCaseDemand> functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
return functionalCaseDemands.get(0).getId(); return functionalCaseDemands.getFirst().getId();
} }
@Test @Test

View File

@ -291,7 +291,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
FunctionalCaseCustomFieldExample customFieldExample = new FunctionalCaseCustomFieldExample(); FunctionalCaseCustomFieldExample customFieldExample = new FunctionalCaseCustomFieldExample();
customFieldExample.createCriteria().andCaseIdEqualTo("TEST_FUNCTIONAL_MINDER_CASE_ID_1").andFieldIdEqualTo("custom_field_minder_gyq_id_3"); customFieldExample.createCriteria().andCaseIdEqualTo("TEST_FUNCTIONAL_MINDER_CASE_ID_1").andFieldIdEqualTo("custom_field_minder_gyq_id_3");
List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample); List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.get(0).getValue(),"P0")); Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.getFirst().getValue(),"P0"));
FunctionalCaseModule functionalCaseModule = functionalCaseModuleMapper.selectByPrimaryKey("TEST_MINDER_MODULE_ID_GYQ7"); FunctionalCaseModule functionalCaseModule = functionalCaseModuleMapper.selectByPrimaryKey("TEST_MINDER_MODULE_ID_GYQ7");
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseModule.getName(),"移动7")); Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseModule.getName(),"移动7"));
@ -313,18 +313,18 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
functionalCaseExample.createCriteria().andNameEqualTo("新增用例"); functionalCaseExample.createCriteria().andNameEqualTo("新增用例");
functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample); functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases));
Assertions.assertTrue(functionalCases.get(0).getPos() > 0L); Assertions.assertTrue(functionalCases.getFirst().getPos() > 0L);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases));
customFieldExample = new FunctionalCaseCustomFieldExample(); customFieldExample = new FunctionalCaseCustomFieldExample();
customFieldExample.createCriteria().andCaseIdEqualTo(functionalCases.get(0).getId()).andFieldIdEqualTo("custom_field_minder_gyq_id_3"); customFieldExample.createCriteria().andCaseIdEqualTo(functionalCases.getFirst().getId()).andFieldIdEqualTo("custom_field_minder_gyq_id_3");
functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample); functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.get(0).getValue(),"P2")); Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.getFirst().getValue(),"P2"));
FunctionalCaseModuleExample functionalCaseModuleExample = new FunctionalCaseModuleExample(); FunctionalCaseModuleExample functionalCaseModuleExample = new FunctionalCaseModuleExample();
functionalCaseModuleExample.createCriteria().andNameEqualTo("新增9"); functionalCaseModuleExample.createCriteria().andNameEqualTo("新增9");
List<FunctionalCaseModule> functionalCaseModules = functionalCaseModuleMapper.selectByExample(functionalCaseModuleExample); List<FunctionalCaseModule> functionalCaseModules = functionalCaseModuleMapper.selectByExample(functionalCaseModuleExample);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCaseModules)); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCaseModules));
Assertions.assertTrue(functionalCaseModules.get(0).getPos() > 0L); Assertions.assertTrue(functionalCaseModules.getFirst().getPos() > 0L);
request = new FunctionalCaseMinderEditRequest(); request = new FunctionalCaseMinderEditRequest();
request.setProjectId("project-case-minder-test"); request.setProjectId("project-case-minder-test");
request.setVersionId("ffff"); request.setVersionId("ffff");

View File

@ -76,7 +76,7 @@ public class FunctionalCaseReviewControllerTests extends BaseTest {
caseReviewHistory.setCreateTime(System.currentTimeMillis()); caseReviewHistory.setCreateTime(System.currentTimeMillis());
caseReviewHistoryMapper.insertSelective(caseReviewHistory); caseReviewHistoryMapper.insertSelective(caseReviewHistory);
List<CaseReviewHistoryDTO> gyqReviewCaseTest = getCaseReviewHistoryList("gyqReviewCaseTest"); List<CaseReviewHistoryDTO> gyqReviewCaseTest = getCaseReviewHistoryList("gyqReviewCaseTest");
Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.get(0).getContentText())); Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.getFirst().getContentText()));
caseReviewHistory = new CaseReviewHistory(); caseReviewHistory = new CaseReviewHistory();
caseReviewHistory.setReviewId("用例关系名称2"); caseReviewHistory.setReviewId("用例关系名称2");
caseReviewHistory.setCaseId("gyqReviewCaseTest"); caseReviewHistory.setCaseId("gyqReviewCaseTest");

View File

@ -581,7 +581,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis()); testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis());
testPlanCaseExecuteHistoryMapper.insertSelective(testPlanCaseExecuteHistory); testPlanCaseExecuteHistoryMapper.insertSelective(testPlanCaseExecuteHistory);
List<TestPlanCaseExecuteHistoryDTO> gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case"); List<TestPlanCaseExecuteHistoryDTO> gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case");
Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.get(0).getContentText())); Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.getFirst().getContentText()));
testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory(); testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory();
testPlanCaseExecuteHistory.setTestPlanCaseId("test_plan_associate_case_gyq_two"); testPlanCaseExecuteHistory.setTestPlanCaseId("test_plan_associate_case_gyq_two");
testPlanCaseExecuteHistory.setTestPlanId("associate_case_plan_gyq_two"); testPlanCaseExecuteHistory.setTestPlanId("associate_case_plan_gyq_two");

View File

@ -94,7 +94,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
reviewers.add("admin"); reviewers.add("admin");
reviewers.add("default-project-member-user-gyq"); reviewers.add("default-project-member-user-gyq");
List<CaseReview> caseReviews = addReview("创建用例评审1", caseIds, reviewers, CaseReviewPassRule.SINGLE.toString()); List<CaseReview> caseReviews = addReview("创建用例评审1", caseIds, reviewers, CaseReviewPassRule.SINGLE.toString());
String reviewId = caseReviews.get(0).getId(); String reviewId = caseReviews.getFirst().getId();
ReviewFunctionalCaseRequest reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest(); ReviewFunctionalCaseRequest reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
reviewFunctionalCaseRequest.setReviewId(reviewId); reviewFunctionalCaseRequest.setReviewId(reviewId);
reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTest"); reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTest");
@ -111,7 +111,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTest"); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTest");
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.PASS.toString())); Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.PASS.toString()));
//单人评审不通过 //单人评审不通过
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest(); reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
reviewFunctionalCaseRequest.setReviewId(reviewId); reviewFunctionalCaseRequest.setReviewId(reviewId);
@ -129,7 +129,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne"); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())); Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString()));
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest(); reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
@ -148,7 +148,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne"); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString())); Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest(); reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
reviewFunctionalCaseRequest.setReviewId(reviewId); reviewFunctionalCaseRequest.setReviewId(reviewId);
@ -161,7 +161,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
reviewFunctionalCaseService.saveReview(reviewFunctionalCaseRequest, "default-project-member-user-gyq-4"); reviewFunctionalCaseService.saveReview(reviewFunctionalCaseRequest, "default-project-member-user-gyq-4");
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne"); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString())); Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest(); reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
reviewFunctionalCaseRequest.setReviewId(reviewId); reviewFunctionalCaseRequest.setReviewId(reviewId);
@ -174,7 +174,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
reviewFunctionalCaseService.saveReview(reviewFunctionalCaseRequest, "admin"); reviewFunctionalCaseService.saveReview(reviewFunctionalCaseRequest, "admin");
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne"); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString())); Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
} }
@Test @Test
@ -187,7 +187,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
reviewers.add("admin"); reviewers.add("admin");
reviewers.add("default-project-member-user-gyq"); reviewers.add("default-project-member-user-gyq");
List<CaseReview> caseReviews = addReview("创建用例评审2", caseIds, reviewers, CaseReviewPassRule.MULTIPLE.toString()); List<CaseReview> caseReviews = addReview("创建用例评审2", caseIds, reviewers, CaseReviewPassRule.MULTIPLE.toString());
String reviewId = caseReviews.get(0).getId(); String reviewId = caseReviews.getFirst().getId();
CaseReviewHistory caseReviewHistory = new CaseReviewHistory(); CaseReviewHistory caseReviewHistory = new CaseReviewHistory();
caseReviewHistory.setReviewId(reviewId); caseReviewHistory.setReviewId(reviewId);
caseReviewHistory.setCaseId("gyqReviewCaseTestTwo"); caseReviewHistory.setCaseId("gyqReviewCaseTestTwo");
@ -213,9 +213,9 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestTwo"); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestTwo");
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.UNDER_REVIEWED.toString())); Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()));
List<CaseReview> caseReviews1 = getCaseReviews("创建用例评审2"); List<CaseReview> caseReviews1 = getCaseReviews("创建用例评审2");
System.out.println(caseReviews1.get(0).getStatus()); System.out.println(caseReviews1.getFirst().getStatus());
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest(); reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
@ -247,7 +247,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
List<String> reviewers = new ArrayList<>(); List<String> reviewers = new ArrayList<>();
reviewers.add("admin"); reviewers.add("admin");
List<CaseReview> caseReviews = addReview("创建用例评审3", caseIds, reviewers, CaseReviewPassRule.MULTIPLE.toString()); List<CaseReview> caseReviews = addReview("创建用例评审3", caseIds, reviewers, CaseReviewPassRule.MULTIPLE.toString());
String reviewId = caseReviews.get(0).getId(); String reviewId = caseReviews.getFirst().getId();
ReviewFunctionalCaseRequest reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest(); ReviewFunctionalCaseRequest reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
reviewFunctionalCaseRequest.setReviewId(reviewId); reviewFunctionalCaseRequest.setReviewId(reviewId);
reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTestThree"); reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTestThree");
@ -264,7 +264,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestThree"); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestThree");
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.PASS.toString())); Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.PASS.toString()));
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest(); reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
reviewFunctionalCaseRequest.setReviewId(reviewId); reviewFunctionalCaseRequest.setReviewId(reviewId);
@ -282,7 +282,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestFour"); caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestFour");
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())); Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString()));
} }
@ -297,7 +297,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
List<String> reviewers = new ArrayList<>(); List<String> reviewers = new ArrayList<>();
reviewers.add("admin"); reviewers.add("admin");
List<CaseReview> caseReviews = addReview("创建用例评审4", caseIds, reviewers, CaseReviewPassRule.SINGLE.toString()); List<CaseReview> caseReviews = addReview("创建用例评审4", caseIds, reviewers, CaseReviewPassRule.SINGLE.toString());
String reviewId = caseReviews.get(0).getId(); String reviewId = caseReviews.getFirst().getId();
ReviewFunctionalCaseRequest reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest(); ReviewFunctionalCaseRequest reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
reviewFunctionalCaseRequest.setReviewId(reviewId); reviewFunctionalCaseRequest.setReviewId(reviewId);
reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTestFour"); reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTestFour");
@ -313,7 +313,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
@Order(4) @Order(4)
public void getListSuccess() throws Exception { public void getListSuccess() throws Exception {
List<CaseReview> caseReviews = getCaseReviews("创建用例评审1"); List<CaseReview> caseReviews = getCaseReviews("创建用例评审1");
String reviewId = caseReviews.get(0).getId(); String reviewId = caseReviews.getFirst().getId();
CaseReviewHistory caseReviewHistory = new CaseReviewHistory(); CaseReviewHistory caseReviewHistory = new CaseReviewHistory();
caseReviewHistory.setReviewId(reviewId); caseReviewHistory.setReviewId(reviewId);
caseReviewHistory.setCaseId("gyqReviewCaseTest"); caseReviewHistory.setCaseId("gyqReviewCaseTest");

View File

@ -19,10 +19,10 @@ public class KeyStoreConfig {
if (CollectionUtils.isNotEmpty(entry)) { if (CollectionUtils.isNotEmpty(entry)) {
List<KeyStoreEntry> entryList = this.entry.stream().filter(KeyStoreEntry::isDefault).collect(Collectors.toList()); List<KeyStoreEntry> entryList = this.entry.stream().filter(KeyStoreEntry::isDefault).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(entryList)) { if (CollectionUtils.isNotEmpty(entryList)) {
if (StringUtils.isNotEmpty(entryList.get(0).getNewAsName())) { if (StringUtils.isNotEmpty(entryList.getFirst().getNewAsName())) {
return entryList.get(0).getNewAsName(); return entryList.getFirst().getNewAsName();
} else { } else {
return entryList.get(0).getOriginalAsName(); return entryList.getFirst().getOriginalAsName();
} }
} }
} }
@ -33,7 +33,7 @@ public class KeyStoreConfig {
if (CollectionUtils.isNotEmpty(entry)) { if (CollectionUtils.isNotEmpty(entry)) {
List<KeyStoreEntry> entryList = this.entry.stream().filter(ks -> StringUtils.equals(asName, ks.getNewAsName())).collect(Collectors.toList()); List<KeyStoreEntry> entryList = this.entry.stream().filter(ks -> StringUtils.equals(asName, ks.getNewAsName())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(entryList) && CollectionUtils.isNotEmpty(files) && files.size() == 1) { if (CollectionUtils.isNotEmpty(entryList) && CollectionUtils.isNotEmpty(files) && files.size() == 1) {
return entryList.get(0).getOriginalAsName(); return entryList.getFirst().getOriginalAsName();
} }
} }
return asName; return asName;

View File

@ -60,7 +60,7 @@ public class MessageTaskLogService {
dto.setPath("/notice/message/task/save"); dto.setPath("/notice/message/task/save");
dto.setMethod(HttpMethodConstants.POST.name()); dto.setMethod(HttpMethodConstants.POST.name());
if (CollectionUtils.isNotEmpty(messageTasks)) { if (CollectionUtils.isNotEmpty(messageTasks)) {
dto.setOriginalValue(JSON.toJSONBytes(messageTasks.get(0))); dto.setOriginalValue(JSON.toJSONBytes(messageTasks.getFirst()));
} }
return dto; return dto;
} }
@ -136,7 +136,7 @@ public class MessageTaskLogService {
ProjectRobotExample projectRobotExample = new ProjectRobotExample(); ProjectRobotExample projectRobotExample = new ProjectRobotExample();
projectRobotExample.createCriteria().andProjectIdEqualTo(projectId).andPlatformEqualTo(NoticeConstants.Type.IN_SITE); projectRobotExample.createCriteria().andProjectIdEqualTo(projectId).andPlatformEqualTo(NoticeConstants.Type.IN_SITE);
List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample); List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample);
robotId = projectRobots.get(0).getId(); robotId = projectRobots.getFirst().getId();
} }
return robotId; return robotId;
} }

View File

@ -85,7 +85,7 @@ public class NoticeMessageTaskService {
sqlSession.flushStatements(); sqlSession.flushStatements();
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
if (CollectionUtils.isNotEmpty(stringListMap.get(NO_USER_NAMES))) { if (CollectionUtils.isNotEmpty(stringListMap.get(NO_USER_NAMES))) {
String message = Translator.get("alert_others") + stringListMap.get(NO_USER_NAMES).get(0) + Translator.get("user.remove"); String message = Translator.get("alert_others") + stringListMap.get(NO_USER_NAMES).getFirst() + Translator.get("user.remove");
return ResultHolder.successCodeErrorInfo(ProjectResultCode.SAVE_MESSAGE_TASK_USER_NO_EXIST.getCode(), message); return ResultHolder.successCodeErrorInfo(ProjectResultCode.SAVE_MESSAGE_TASK_USER_NO_EXIST.getCode(), message);
} }
return ResultHolder.success("OK"); return ResultHolder.success("OK");
@ -130,7 +130,7 @@ public class NoticeMessageTaskService {
ProjectRobotExample projectRobotExample = new ProjectRobotExample(); ProjectRobotExample projectRobotExample = new ProjectRobotExample();
projectRobotExample.createCriteria().andProjectIdEqualTo(projectId).andPlatformEqualTo(NoticeConstants.Type.IN_SITE); projectRobotExample.createCriteria().andProjectIdEqualTo(projectId).andPlatformEqualTo(NoticeConstants.Type.IN_SITE);
List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample); List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample);
return projectRobots.get(0); return projectRobots.getFirst();
} else { } else {
return projectRobotMapper.selectByPrimaryKey(robotId); return projectRobotMapper.selectByPrimaryKey(robotId);
} }
@ -503,9 +503,9 @@ public class NoticeMessageTaskService {
} }
Map<String, List<MessageTask>> messageRobotMap = messageTasks.stream().collect(Collectors.groupingBy(MessageTask::getProjectRobotId)); Map<String, List<MessageTask>> messageRobotMap = messageTasks.stream().collect(Collectors.groupingBy(MessageTask::getProjectRobotId));
if (CollectionUtils.isNotEmpty(messageRobotMap.get(robotId))) { if (CollectionUtils.isNotEmpty(messageRobotMap.get(robotId))) {
messageTask = messageRobotMap.get(robotId).get(0); messageTask = messageRobotMap.get(robotId).getFirst();
} else { } else {
messageTask = messageTasks.get(0); messageTask = messageTasks.getFirst();
messageTask.setEnable(false); messageTask.setEnable(false);
messageTask.setUseDefaultTemplate(true); messageTask.setUseDefaultTemplate(true);
messageTask.setUseDefaultSubject(true); messageTask.setUseDefaultSubject(true);

View File

@ -422,7 +422,7 @@ public class ProjectApplicationService {
example.createCriteria().andTypeEqualTo(String.valueOf(module)).andProjectIdEqualTo(projectId); example.createCriteria().andTypeEqualTo(String.valueOf(module)).andProjectIdEqualTo(projectId);
List<ProjectApplication> applications = projectApplicationMapper.selectByExample(example); List<ProjectApplication> applications = projectApplicationMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(applications)) { if (CollectionUtils.isNotEmpty(applications)) {
moduleMap.put(String.valueOf(module), Boolean.valueOf(applications.get(0).getTypeValue())); moduleMap.put(String.valueOf(module), Boolean.valueOf(applications.getFirst().getTypeValue()));
} else { } else {
moduleMap.put(String.valueOf(module), Boolean.TRUE); moduleMap.put(String.valueOf(module), Boolean.TRUE);
} }
@ -542,7 +542,7 @@ public class ProjectApplicationService {
example.createCriteria().andProjectIdEqualTo(projectId).andTypeLike(ProjectApplicationType.BUG.BUG_SYNC.name() + "_" + ProjectApplicationType.PLATFORM_BUG_CONFIG.BUG_PLATFORM_CONFIG.name()); example.createCriteria().andProjectIdEqualTo(projectId).andTypeLike(ProjectApplicationType.BUG.BUG_SYNC.name() + "_" + ProjectApplicationType.PLATFORM_BUG_CONFIG.BUG_PLATFORM_CONFIG.name());
List<ProjectApplication> list = projectApplicationMapper.selectByExample(example); List<ProjectApplication> list = projectApplicationMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
return list.get(0).getTypeValue().replaceAll("\\\\", ""); return list.getFirst().getTypeValue().replaceAll("\\\\", "");
} }
return null; return null;
} }
@ -559,7 +559,7 @@ public class ProjectApplicationService {
example.createCriteria().andProjectIdEqualTo(projectId).andTypeLike(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.PLATFORM_DEMAND_CONFIG.DEMAND_PLATFORM_CONFIG.name()); example.createCriteria().andProjectIdEqualTo(projectId).andTypeLike(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.PLATFORM_DEMAND_CONFIG.DEMAND_PLATFORM_CONFIG.name());
List<ProjectApplication> list = projectApplicationMapper.selectByExample(example); List<ProjectApplication> list = projectApplicationMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
return list.get(0).getTypeValue().replaceAll("\\\\", ""); return list.getFirst().getTypeValue().replaceAll("\\\\", "");
} }
return null; return null;
} }
@ -568,7 +568,7 @@ public class ProjectApplicationService {
ProjectApplicationExample example = new ProjectApplicationExample(); ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(type); example.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(type);
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example); List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example);
return CollectionUtils.isEmpty(projectApplications) ? null : projectApplications.get(0); return CollectionUtils.isEmpty(projectApplications) ? null : projectApplications.getFirst();
} }
/** /**
@ -604,7 +604,7 @@ public class ProjectApplicationService {
example.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(ProjectApplicationType.BUG.BUG_SYNC.name() + "_MECHANISM"); example.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(ProjectApplicationType.BUG.BUG_SYNC.name() + "_MECHANISM");
List<ProjectApplication> list = projectApplicationMapper.selectByExample(example); List<ProjectApplication> list = projectApplicationMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
return StringUtils.equals(list.get(0).getTypeValue(), "increment"); return StringUtils.equals(list.getFirst().getTypeValue(), "increment");
} else { } else {
return false; return false;
} }

View File

@ -128,11 +128,11 @@ public class ProjectRobotService {
List<ProjectRobot> newProjectRobots = new ArrayList<>(list.stream().sorted(Comparator.comparing(ProjectRobot::getCreateTime).reversed()).toList()); List<ProjectRobot> newProjectRobots = new ArrayList<>(list.stream().sorted(Comparator.comparing(ProjectRobot::getCreateTime).reversed()).toList());
List<ProjectRobot> mailRobot = collect.get(NoticeConstants.Type.MAIL); List<ProjectRobot> mailRobot = collect.get(NoticeConstants.Type.MAIL);
if (CollectionUtils.isNotEmpty(mailRobot)) { if (CollectionUtils.isNotEmpty(mailRobot)) {
newProjectRobots.add(0, mailRobot.get(0)); newProjectRobots.add(0, mailRobot.getFirst());
} }
List<ProjectRobot> inSiteRobot = collect.get(NoticeConstants.Type.IN_SITE); List<ProjectRobot> inSiteRobot = collect.get(NoticeConstants.Type.IN_SITE);
if (CollectionUtils.isNotEmpty(inSiteRobot)) { if (CollectionUtils.isNotEmpty(inSiteRobot)) {
newProjectRobots.add(0, inSiteRobot.get(0)); newProjectRobots.add(0, inSiteRobot.getFirst());
} }
return newProjectRobots; return newProjectRobots;
} }

View File

@ -212,7 +212,7 @@ public class ProjectTemplateService extends BaseTemplateService {
.andScopeIdEqualTo(projectId) .andScopeIdEqualTo(projectId)
.andSceneEqualTo(scene) .andSceneEqualTo(scene)
.andInternalEqualTo(true); .andInternalEqualTo(true);
return templateMapper.selectByExample(example).get(0); return templateMapper.selectByExample(example).getFirst();
} }
/** /**

View File

@ -68,7 +68,7 @@ public class ProjectUserRoleLogService {
UserRoleExample example = new UserRoleExample(); UserRoleExample example = new UserRoleExample();
example.createCriteria().andIdEqualTo(request.getId()); example.createCriteria().andIdEqualTo(request.getId());
UserRole userRole = userRoleMapper.selectByExample(example).get(0); UserRole userRole = userRoleMapper.selectByExample(example).getFirst();
dto.setOriginalValue(JSON.toJSONBytes(userRole.getName())); dto.setOriginalValue(JSON.toJSONBytes(userRole.getName()));
dto.setModifiedValue(JSON.toJSONBytes(request.getName())); dto.setModifiedValue(JSON.toJSONBytes(request.getName()));
return dto; return dto;

View File

@ -124,7 +124,7 @@ public class ProjectUserRoleService extends BaseUserRoleService {
} }
public void removeMember(ProjectUserRoleMemberEditRequest request) { public void removeMember(ProjectUserRoleMemberEditRequest request) {
String removeUserId = request.getUserIds().get(0); String removeUserId = request.getUserIds().getFirst();
checkMemberParam(removeUserId, request.getUserRoleId()); checkMemberParam(removeUserId, request.getUserRoleId());
//检查移除的是不是管理员 //检查移除的是不是管理员
if (StringUtils.equals(request.getUserRoleId(),InternalUserRole.PROJECT_ADMIN.getValue())) { if (StringUtils.equals(request.getUserRoleId(),InternalUserRole.PROJECT_ADMIN.getValue())) {

View File

@ -55,7 +55,7 @@ public class CreateEnvironmentTests extends BaseTest {
environmentExample.createCriteria().andProjectIdEqualTo(initProject.getId()).andNameEqualTo("Mock环境"); environmentExample.createCriteria().andProjectIdEqualTo(initProject.getId()).andNameEqualTo("Mock环境");
List<Environment> environments = environmentMapper.selectByExample(environmentExample); List<Environment> environments = environmentMapper.selectByExample(environmentExample);
assert environments.size() == 1; assert environments.size() == 1;
EnvironmentBlob environmentBlob = environmentBlobMapper.selectByPrimaryKey(environments.get(0).getId()); EnvironmentBlob environmentBlob = environmentBlobMapper.selectByPrimaryKey(environments.getFirst().getId());
assert environmentBlob != null; assert environmentBlob != null;
} }

View File

@ -1142,8 +1142,8 @@ public class EnvironmentControllerTests extends BaseTest {
MvcResult mvcResult = requestGetWithOkAndReturn(SCRIPTS, DEFAULT_PROJECT_ID); MvcResult mvcResult = requestGetWithOkAndReturn(SCRIPTS, DEFAULT_PROJECT_ID);
List<EnvironmentPluginScriptDTO> envScripts = getResultDataArray(mvcResult, EnvironmentPluginScriptDTO.class); List<EnvironmentPluginScriptDTO> envScripts = getResultDataArray(mvcResult, EnvironmentPluginScriptDTO.class);
Assertions.assertEquals(envScripts.size(), 1); Assertions.assertEquals(envScripts.size(), 1);
Assertions.assertEquals(envScripts.get(0).getPluginId(), "tcp-sampler"); Assertions.assertEquals(envScripts.getFirst().getPluginId(), "tcp-sampler");
Assertions.assertEquals(((Map) envScripts.get(0).getScript()).get("id"), "environment"); Assertions.assertEquals(((Map) envScripts.getFirst().getScript()).get("id"), "environment");
// 删除环境脚本测试是否正常执行 // 删除环境脚本测试是否正常执行
pluginScriptMapper.deleteByPrimaryKey(plugin.getId(), "environment"); pluginScriptMapper.deleteByPrimaryKey(plugin.getId(), "environment");

View File

@ -111,7 +111,7 @@ public class FakeErrorControllerTests extends BaseTest {
List<FakeError> fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample()); List<FakeError> fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample());
List<FakeErrorDTO> dtoList = new ArrayList<>(); List<FakeErrorDTO> dtoList = new ArrayList<>();
FakeErrorDTO dto = new FakeErrorDTO(); FakeErrorDTO dto = new FakeErrorDTO();
dto.setId(fakeErrors.get(0).getId()); dto.setId(fakeErrors.getFirst().getId());
dto.setName("测试新增误报规则更新"); dto.setName("测试新增误报规则更新");
dto.setExpression("ok"); dto.setExpression("ok");
dto.setProjectId(DEFAULT_PROJECT_ID); dto.setProjectId(DEFAULT_PROJECT_ID);
@ -125,7 +125,7 @@ public class FakeErrorControllerTests extends BaseTest {
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
Assertions.assertNotNull(resultHolder); Assertions.assertNotNull(resultHolder);
fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample()); fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample());
Assertions.assertTrue(fakeErrors.get(0).getEnable()); Assertions.assertTrue(fakeErrors.getFirst().getEnable());
mvcResult = this.requestPostWithOkAndReturn(ADD, dtoList); mvcResult = this.requestPostWithOkAndReturn(ADD, dtoList);
returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
@ -168,7 +168,7 @@ public class FakeErrorControllerTests extends BaseTest {
Assertions.assertNotNull(resultHolder); Assertions.assertNotNull(resultHolder);
//名字重复不更新 //名字重复不更新
fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample()); fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample());
Assertions.assertFalse(StringUtils.equalsIgnoreCase(fakeErrors.get(0).getName(),fakeErrors.get(1).getName())); Assertions.assertFalse(StringUtils.equalsIgnoreCase(fakeErrors.getFirst().getName(),fakeErrors.get(1).getName()));
} }
@Test @Test
@ -201,7 +201,7 @@ public class FakeErrorControllerTests extends BaseTest {
fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample()); fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample());
list = fakeErrors.stream().filter(FakeError::getEnable).toList(); list = fakeErrors.stream().filter(FakeError::getEnable).toList();
Assertions.assertEquals(0,list.size()); Assertions.assertEquals(0,list.size());
String oneId = ids.get(0); String oneId = ids.getFirst();
fakeErrorStatusRequest = new FakeErrorStatusRequest(); fakeErrorStatusRequest = new FakeErrorStatusRequest();
fakeErrorStatusRequest.setProjectId(DEFAULT_PROJECT_ID); fakeErrorStatusRequest.setProjectId(DEFAULT_PROJECT_ID);
fakeErrorStatusRequest.setEnable(true); fakeErrorStatusRequest.setEnable(true);
@ -237,7 +237,7 @@ public class FakeErrorControllerTests extends BaseTest {
FakeErrorExample fakeErrorExample = new FakeErrorExample(); FakeErrorExample fakeErrorExample = new FakeErrorExample();
fakeErrorExample.createCriteria().andNameLike("用来删除"); fakeErrorExample.createCriteria().andNameLike("用来删除");
List<FakeError> fakeErrors = fakeErrorMapper.selectByExample(fakeErrorExample); List<FakeError> fakeErrors = fakeErrorMapper.selectByExample(fakeErrorExample);
String deleteId = fakeErrors.get(0).getId(); String deleteId = fakeErrors.getFirst().getId();
Assertions.assertEquals(1,fakeErrors.size()); Assertions.assertEquals(1,fakeErrors.size());
FakeErrorDelRequest request = new FakeErrorDelRequest(); FakeErrorDelRequest request = new FakeErrorDelRequest();
request.setProjectId(DEFAULT_PROJECT_ID); request.setProjectId(DEFAULT_PROJECT_ID);

View File

@ -141,8 +141,8 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
messageTaskExample.createCriteria() messageTaskExample.createCriteria()
.andProjectIdEqualTo("project-message-test").andProjectRobotIdEqualTo("test_message_robot2").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE); .andProjectIdEqualTo("project-message-test").andProjectRobotIdEqualTo("test_message_robot2").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE);
List<MessageTask> messageTasks1 = messageTaskMapper.selectByExample(messageTaskExample); List<MessageTask> messageTasks1 = messageTaskMapper.selectByExample(messageTaskExample);
Assertions.assertTrue(messageTasks1.get(0).getEnable()); Assertions.assertTrue(messageTasks1.getFirst().getEnable());
Assertions.assertTrue(StringUtils.equalsIgnoreCase(messageTasks1.get(0).getSubject(), "看看改不改")); Assertions.assertTrue(StringUtils.equalsIgnoreCase(messageTasks1.getFirst().getSubject(), "看看改不改"));
messageTaskExample = new MessageTaskExample(); messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria().andProjectIdEqualTo("project-message-test").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE); messageTaskExample.createCriteria().andProjectIdEqualTo("project-message-test").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE);
@ -267,8 +267,8 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
} }
} }
Assertions.assertEquals("test_message_robot2", messageTasks.get(0).getProjectRobotId()); Assertions.assertEquals("test_message_robot2", messageTasks.getFirst().getProjectRobotId());
Assertions.assertEquals(false, messageTasks.get(0).getEnable()); Assertions.assertEquals(false, messageTasks.getFirst().getEnable());
} }
@Test @Test
@ -364,7 +364,7 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
List<MessageTaskDTO> messageTaskDetailDTOList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), MessageTaskDTO.class); List<MessageTaskDTO> messageTaskDetailDTOList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), MessageTaskDTO.class);
MessageTaskDetailDTO messageTaskDetailDTO = messageTaskDetailDTOList.get(0).getMessageTaskTypeDTOList().get(0).getMessageTaskDetailDTOList().get(0); MessageTaskDetailDTO messageTaskDetailDTO = messageTaskDetailDTOList.getFirst().getMessageTaskTypeDTOList().getFirst().getMessageTaskDetailDTOList().getFirst();
Map<String, ProjectRobotConfigDTO> projectRobotConfigMap = messageTaskDetailDTO.getProjectRobotConfigMap(); Map<String, ProjectRobotConfigDTO> projectRobotConfigMap = messageTaskDetailDTO.getProjectRobotConfigMap();
System.out.println(projectRobotConfigMap); System.out.println(projectRobotConfigMap);
// Assertions.assertTrue(StringUtils.isBlank(robotId)); // Assertions.assertTrue(StringUtils.isBlank(robotId));
@ -498,11 +498,11 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
Assertions.assertTrue(CollectionUtils.isNotEmpty(messageTaskDetailDTOList)); Assertions.assertTrue(CollectionUtils.isNotEmpty(messageTaskDetailDTOList));
System.out.println(messageTaskDetailDTOList); System.out.println(messageTaskDetailDTOList);
List<MessageTaskDTO> collect = messageTaskDetailDTOList.stream().filter(t -> t.type.equals(NoticeConstants.Module.API_TEST_MANAGEMENT)).toList(); List<MessageTaskDTO> collect = messageTaskDetailDTOList.stream().filter(t -> t.type.equals(NoticeConstants.Module.API_TEST_MANAGEMENT)).toList();
List<MessageTaskTypeDTO> messageTaskTypeDTOList = collect.get(0).getMessageTaskTypeDTOList(); List<MessageTaskTypeDTO> messageTaskTypeDTOList = collect.getFirst().getMessageTaskTypeDTOList();
List<MessageTaskTypeDTO> collect1 = messageTaskTypeDTOList.stream().filter(t -> t.getTaskType().equals(NoticeConstants.TaskType.API_DEFINITION_TASK)).toList(); List<MessageTaskTypeDTO> collect1 = messageTaskTypeDTOList.stream().filter(t -> t.getTaskType().equals(NoticeConstants.TaskType.API_DEFINITION_TASK)).toList();
List<MessageTaskDetailDTO> messageTaskDetailDTOList1 = collect1.get(0).getMessageTaskDetailDTOList(); List<MessageTaskDetailDTO> messageTaskDetailDTOList1 = collect1.getFirst().getMessageTaskDetailDTOList();
List<MessageTaskDetailDTO> collect2 = messageTaskDetailDTOList1.stream().filter(t -> t.event.equals(NoticeConstants.Event.CREATE)).toList(); List<MessageTaskDetailDTO> collect2 = messageTaskDetailDTOList1.stream().filter(t -> t.event.equals(NoticeConstants.Event.CREATE)).toList();
Map<String, ProjectRobotConfigDTO> projectRobotConfigMap = collect2.get(0).getProjectRobotConfigMap(); Map<String, ProjectRobotConfigDTO> projectRobotConfigMap = collect2.getFirst().getProjectRobotConfigMap();
ProjectRobotConfigDTO projectRobotConfigDTO = projectRobotConfigMap.get("test_message_robot2"); ProjectRobotConfigDTO projectRobotConfigDTO = projectRobotConfigMap.get("test_message_robot2");
Assertions.assertTrue(StringUtils.equals(projectRobotConfigDTO.getTemplate(),"发送消息测试")); Assertions.assertTrue(StringUtils.equals(projectRobotConfigDTO.getTemplate(),"发送消息测试"));
} }

View File

@ -191,12 +191,12 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
CustomFieldExample example = new CustomFieldExample(); CustomFieldExample example = new CustomFieldExample();
example.createCriteria().andScopeIdEqualTo(DEFAULT_PROJECT_ID).andNameEqualTo("functional_priority"); example.createCriteria().andScopeIdEqualTo(DEFAULT_PROJECT_ID).andNameEqualTo("functional_priority");
CustomFieldUpdateRequest internalRequest = BeanUtils.copyBean(new CustomFieldUpdateRequest(), customFieldMapper.selectByExample(example).get(0)); CustomFieldUpdateRequest internalRequest = BeanUtils.copyBean(new CustomFieldUpdateRequest(), customFieldMapper.selectByExample(example).getFirst());
internalRequest.setName("aaaa"); internalRequest.setName("aaaa");
this.requestPostWithOk(DEFAULT_UPDATE, internalRequest); this.requestPostWithOk(DEFAULT_UPDATE, internalRequest);
Assertions.assertEquals(customFieldMapper.selectByExample(example).get(0).getInternal(), true); Assertions.assertEquals(customFieldMapper.selectByExample(example).getFirst().getInternal(), true);
// 内置字段名称不能修改 // 内置字段名称不能修改
Assertions.assertEquals(customFieldMapper.selectByExample(example).get(0).getName(), "functional_priority"); Assertions.assertEquals(customFieldMapper.selectByExample(example).getFirst().getName(), "functional_priority");
// @校验是否开启项目模板 // @校验是否开启项目模板
changeOrgTemplateEnable(true); changeOrgTemplateEnable(true);
@ -246,8 +246,8 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
if (StringUtils.equalsAny(resultItem.getType(), CustomFieldType.MEMBER.name(), CustomFieldType.MULTIPLE_MEMBER.name())) { if (StringUtils.equalsAny(resultItem.getType(), CustomFieldType.MEMBER.name(), CustomFieldType.MULTIPLE_MEMBER.name())) {
List<CustomFieldOption> options = resultList.get(i).getOptions(); List<CustomFieldOption> options = resultList.get(i).getOptions();
Assertions.assertEquals(options.size(), 1); Assertions.assertEquals(options.size(), 1);
Assertions.assertEquals(options.get(0).getValue(), "CREATE_USER"); Assertions.assertEquals(options.getFirst().getValue(), "CREATE_USER");
Assertions.assertEquals(options.get(0).getText(), "创建人"); Assertions.assertEquals(options.getFirst().getText(), "创建人");
} else if (CustomFieldType.getHasOptionValueSet().contains(resultItem.getType())) { } else if (CustomFieldType.getHasOptionValueSet().contains(resultItem.getType())) {
// 有下拉框选项的校验选项 // 有下拉框选项的校验选项
Assertions.assertEquals(resultList.get(i).getOptions().stream().sorted(Comparator.comparing(CustomFieldOption::getValue)).toList(), Assertions.assertEquals(resultList.get(i).getOptions().stream().sorted(Comparator.comparing(CustomFieldOption::getValue)).toList(),
@ -300,7 +300,7 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
CustomFieldExample example = new CustomFieldExample(); CustomFieldExample example = new CustomFieldExample();
example.createCriteria() example.createCriteria()
.andInternalEqualTo(true); .andInternalEqualTo(true);
CustomField internalCustomField = customFieldMapper.selectByExample(example).get(0); CustomField internalCustomField = customFieldMapper.selectByExample(example).getFirst();
assertErrorCode(this.requestGet(DEFAULT_DELETE, internalCustomField.getId()), INTERNAL_CUSTOM_FIELD_PERMISSION); assertErrorCode(this.requestGet(DEFAULT_DELETE, internalCustomField.getId()), INTERNAL_CUSTOM_FIELD_PERMISSION);
// @@校验 NOT_FOUND 异常 // @@校验 NOT_FOUND 异常

View File

@ -63,7 +63,7 @@ public class ProjectMemberControllerTests extends BaseTest {
// 返回的数据量不超过规定要返回的数据量相同 // 返回的数据量不超过规定要返回的数据量相同
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
// 返回值中取出第一条数据, 并判断name, email, phone是否包含关键字default // 返回值中取出第一条数据, 并判断name, email, phone是否包含关键字default
ProjectUserDTO projectUserDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserDTO.class).get(0); ProjectUserDTO projectUserDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(projectUserDTO.getName(), request.getKeyword()) Assertions.assertTrue(StringUtils.contains(projectUserDTO.getName(), request.getKeyword())
|| StringUtils.contains(projectUserDTO.getEmail(), request.getKeyword()) || StringUtils.contains(projectUserDTO.getEmail(), request.getKeyword())
|| StringUtils.contains(projectUserDTO.getPhone(), request.getKeyword())); || StringUtils.contains(projectUserDTO.getPhone(), request.getKeyword()));

View File

@ -394,7 +394,7 @@ public class ProjectRobotControllerTests extends BaseTest {
for (MessageTaskDTO messageTaskDTO : messageTaskDetailDTOList) { for (MessageTaskDTO messageTaskDTO : messageTaskDetailDTOList) {
for (MessageTaskTypeDTO messageTaskTypeDTO : messageTaskDTO.getMessageTaskTypeDTOList()) { for (MessageTaskTypeDTO messageTaskTypeDTO : messageTaskDTO.getMessageTaskTypeDTOList()) {
if (StringUtils.equalsIgnoreCase(messageTaskTypeDTO.getTaskType(),NoticeConstants.TaskType.API_DEFINITION_TASK)) { if (StringUtils.equalsIgnoreCase(messageTaskTypeDTO.getTaskType(),NoticeConstants.TaskType.API_DEFINITION_TASK)) {
Boolean testRobotMessageRobot1 = messageTaskTypeDTO.getMessageTaskDetailDTOList().get(0).getProjectRobotConfigMap().get(projectRobotId).getEnable(); Boolean testRobotMessageRobot1 = messageTaskTypeDTO.getMessageTaskDetailDTOList().getFirst().getProjectRobotConfigMap().get(projectRobotId).getEnable();
Assertions.assertTrue(testRobotMessageRobot1); Assertions.assertTrue(testRobotMessageRobot1);
} }
} }
@ -513,7 +513,7 @@ public class ProjectRobotControllerTests extends BaseTest {
ProjectRobotExample projectRobotExample = new ProjectRobotExample(); ProjectRobotExample projectRobotExample = new ProjectRobotExample();
projectRobotExample.createCriteria().andProjectIdEqualTo(projectId).andNameEqualTo(keyWord); projectRobotExample.createCriteria().andProjectIdEqualTo(projectId).andNameEqualTo(keyWord);
List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample); List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample);
return projectRobots.get(0); return projectRobots.getFirst();
} }
public void setMessageTask(String projectId, String defaultRobotId) throws Exception { public void setMessageTask(String projectId, String defaultRobotId) throws Exception {

View File

@ -99,7 +99,7 @@ public class ProjectTemplateControllerTests extends BaseTest {
// @@校验没有数据的情况 // @@校验没有数据的情况
MvcResult mvcResult = this.requestGetWithOkAndReturn(LIST, DEFAULT_PROJECT_ID, TemplateScene.FUNCTIONAL.name()); MvcResult mvcResult = this.requestGetWithOkAndReturn(LIST, DEFAULT_PROJECT_ID, TemplateScene.FUNCTIONAL.name());
List<Template> templates = getResultDataArray(mvcResult, Template.class); List<Template> templates = getResultDataArray(mvcResult, Template.class);
this.defaultTemplate = templates.get(0); this.defaultTemplate = templates.getFirst();
this.requestGetWithOkAndReturn(LIST, DEFAULT_PROJECT_ID, TemplateScene.BUG.name()); this.requestGetWithOkAndReturn(LIST, DEFAULT_PROJECT_ID, TemplateScene.BUG.name());
} }
@ -194,7 +194,7 @@ public class ProjectTemplateControllerTests extends BaseTest {
request.setEnableThirdPart(true); request.setEnableThirdPart(true);
request.setCustomFields(new ArrayList<>(0)); request.setCustomFields(new ArrayList<>(0));
request.setSystemFields(OrganizationTemplateControllerTests.getTemplateSystemCustomFieldRequests()); request.setSystemFields(OrganizationTemplateControllerTests.getTemplateSystemCustomFieldRequests());
request.getSystemFields().get(0).setDefaultValue("update"); request.getSystemFields().getFirst().setDefaultValue("update");
this.requestPostWithOk(DEFAULT_UPDATE, request); this.requestPostWithOk(DEFAULT_UPDATE, request);
Template template = templateMapper.selectByPrimaryKey(request.getId()); Template template = templateMapper.selectByPrimaryKey(request.getId());
// 校验请求成功数据 // 校验请求成功数据
@ -216,12 +216,12 @@ public class ProjectTemplateControllerTests extends BaseTest {
TemplateExample example = new TemplateExample(); TemplateExample example = new TemplateExample();
example.createCriteria().andScopeIdEqualTo(DEFAULT_PROJECT_ID).andNameEqualTo("functional_default"); example.createCriteria().andScopeIdEqualTo(DEFAULT_PROJECT_ID).andNameEqualTo("functional_default");
TemplateUpdateRequest internalRequest = BeanUtils.copyBean(new TemplateUpdateRequest(), templateMapper.selectByExample(example).get(0)); TemplateUpdateRequest internalRequest = BeanUtils.copyBean(new TemplateUpdateRequest(), templateMapper.selectByExample(example).getFirst());
internalRequest.setName("aaaa"); internalRequest.setName("aaaa");
this.requestPostWithOk(DEFAULT_UPDATE, internalRequest); this.requestPostWithOk(DEFAULT_UPDATE, internalRequest);
Assertions.assertEquals(templateMapper.selectByExample(example).get(0).getInternal(), true); Assertions.assertEquals(templateMapper.selectByExample(example).getFirst().getInternal(), true);
// 内置字段名称不能修改 // 内置字段名称不能修改
Assertions.assertEquals(templateMapper.selectByExample(example).get(0).getName(), "functional_default"); Assertions.assertEquals(templateMapper.selectByExample(example).getFirst().getName(), "functional_default");
// 不更新字段 // 不更新字段
request.setCustomFields(null); request.setCustomFields(null);
@ -355,7 +355,7 @@ public class ProjectTemplateControllerTests extends BaseTest {
TemplateExample example = new TemplateExample(); TemplateExample example = new TemplateExample();
example.createCriteria().andScopeIdEqualTo(DEFAULT_PROJECT_ID).andNameEqualTo("functional_default"); example.createCriteria().andScopeIdEqualTo(DEFAULT_PROJECT_ID).andNameEqualTo("functional_default");
mvcResult = this.requestGetWithOkAndReturn(DEFAULT_GET, templateMapper.selectByExample(example).get(0).getId()); mvcResult = this.requestGetWithOkAndReturn(DEFAULT_GET, templateMapper.selectByExample(example).getFirst().getId());
templateDTO = getResultData(mvcResult, TemplateDTO.class); templateDTO = getResultData(mvcResult, TemplateDTO.class);
Assertions.assertEquals(templateDTO.getName(), Translator.get("template.default")); Assertions.assertEquals(templateDTO.getName(), Translator.get("template.default"));

View File

@ -89,7 +89,7 @@ public class ProjectUserRoleControllerTests extends BaseTest {
// 返回的数据量不超过规定要返回的数据量相同 // 返回的数据量不超过规定要返回的数据量相同
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
// 返回值中取出第一条数据, 并判断是否包含关键字default // 返回值中取出第一条数据, 并判断是否包含关键字default
ProjectUserRoleDTO projectUserRoleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).get(0); ProjectUserRoleDTO projectUserRoleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(projectUserRoleDTO.getName(), request.getKeyword()) Assertions.assertTrue(StringUtils.contains(projectUserRoleDTO.getName(), request.getKeyword())
|| StringUtils.contains(projectUserRoleDTO.getId(), request.getKeyword())); || StringUtils.contains(projectUserRoleDTO.getId(), request.getKeyword()));
// 权限校验 // 权限校验
@ -130,7 +130,7 @@ public class ProjectUserRoleControllerTests extends BaseTest {
Pager<?> pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class); Pager<?> pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class);
// 返回值不为空, 取第一条是否包含关键字 // 返回值不为空, 取第一条是否包含关键字
Assertions.assertNotNull(pageData); Assertions.assertNotNull(pageData);
ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).get(0); ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(roleDTO.getName(), roleRequest.getKeyword()) Assertions.assertTrue(StringUtils.contains(roleDTO.getName(), roleRequest.getKeyword())
|| StringUtils.contains(roleDTO.getId(), roleRequest.getKeyword())); || StringUtils.contains(roleDTO.getId(), roleRequest.getKeyword()));
// 权限校验 // 权限校验
@ -199,7 +199,7 @@ public class ProjectUserRoleControllerTests extends BaseTest {
Pager<?> pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class); Pager<?> pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class);
// 返回值不为空 // 返回值不为空
Assertions.assertNotNull(pageData); Assertions.assertNotNull(pageData);
ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).get(0); ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(roleDTO.getName(), roleRequest.getKeyword()) Assertions.assertTrue(StringUtils.contains(roleDTO.getName(), roleRequest.getKeyword())
|| StringUtils.contains(roleDTO.getId(), roleRequest.getKeyword())); || StringUtils.contains(roleDTO.getId(), roleRequest.getKeyword()));
// 权限校验 // 权限校验
@ -310,7 +310,7 @@ public class ProjectUserRoleControllerTests extends BaseTest {
// 返回值中取出第一条数据, 并判断是否包含关键字 // 返回值中取出第一条数据, 并判断是否包含关键字
List<User> userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class); List<User> userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class);
if (CollectionUtils.isNotEmpty(userList)) { if (CollectionUtils.isNotEmpty(userList)) {
User user = userList.get(0); User user = userList.getFirst();
Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword()) Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword())
|| StringUtils.contains(user.getId(), request.getKeyword())); || StringUtils.contains(user.getId(), request.getKeyword()));
} }

View File

@ -1599,7 +1599,7 @@ public class FileManagementControllerTests extends BaseTest {
} }
private void fileAssociationControllerUpgrade() throws Exception { private void fileAssociationControllerUpgrade() throws Exception {
String associationId = sourceAssociationFileMap.get("sty-file-association-bug-id-2").get(0); String associationId = sourceAssociationFileMap.get("sty-file-association-bug-id-2").getFirst();
MvcResult mvcResult = this.requestGetWithOkAndReturn(String.format(FileManagementRequestUtils.URL_FILE_ASSOCIATION_UPGRADE, project.getId(), associationId)); MvcResult mvcResult = this.requestGetWithOkAndReturn(String.format(FileManagementRequestUtils.URL_FILE_ASSOCIATION_UPGRADE, project.getId(), associationId));
String fileId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString(); String fileId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString();
FileMetadataExample example = new FileMetadataExample(); FileMetadataExample example = new FileMetadataExample();
@ -1703,7 +1703,7 @@ public class FileManagementControllerTests extends BaseTest {
FileAssociationExample example = new FileAssociationExample(); FileAssociationExample example = new FileAssociationExample();
example.createCriteria().andFileIdEqualTo(fileAssociationOldFileId).andSourceIdEqualTo("sty-file-association-bug-id-4"); example.createCriteria().andFileIdEqualTo(fileAssociationOldFileId).andSourceIdEqualTo("sty-file-association-bug-id-4");
FileAssociation upgradeFileAssociation = fileAssociationMapper.selectByExample(example).get(0); FileAssociation upgradeFileAssociation = fileAssociationMapper.selectByExample(example).getFirst();
Assertions.assertTrue(sourceAssociationFileMap.get("sty-file-association-bug-id-4").contains(upgradeFileAssociation.getId())); Assertions.assertTrue(sourceAssociationFileMap.get("sty-file-association-bug-id-4").contains(upgradeFileAssociation.getId()));
//当前文件不是最新的 //当前文件不是最新的
fileAssociationService.upgrade(upgradeFileAssociation.getId(), fileLogRecord); fileAssociationService.upgrade(upgradeFileAssociation.getId(), fileLogRecord);
@ -1728,7 +1728,7 @@ public class FileManagementControllerTests extends BaseTest {
//使用bug-id-2测试 1.关联表中的文件ID不存在 //使用bug-id-2测试 1.关联表中的文件ID不存在
example.clear(); example.clear();
example.createCriteria().andFileIdEqualTo(fileAssociationOldFileId).andSourceIdEqualTo("sty-file-association-bug-id-2"); example.createCriteria().andFileIdEqualTo(fileAssociationOldFileId).andSourceIdEqualTo("sty-file-association-bug-id-2");
FileAssociation upgrade2 = fileAssociationMapper.selectByExample(example).get(0); FileAssociation upgrade2 = fileAssociationMapper.selectByExample(example).getFirst();
//先把文件id改成别的测试完成改回来 //先把文件id改成别的测试完成改回来
String originalFileId = upgrade2.getFileId(); String originalFileId = upgrade2.getFileId();
String originalRefId = upgrade2.getFileRefId(); String originalRefId = upgrade2.getFileRefId();
@ -1851,7 +1851,7 @@ public class FileManagementControllerTests extends BaseTest {
//3.里面包含一条已经文件已经删除了的ID 资源为bug-2 //3.里面包含一条已经文件已经删除了的ID 资源为bug-2
example.clear(); example.clear();
example.createCriteria().andSourceIdEqualTo("sty-file-association-bug-id-2").andFileIdEqualTo(fileAssociationNewFilesThree); example.createCriteria().andSourceIdEqualTo("sty-file-association-bug-id-2").andFileIdEqualTo(fileAssociationNewFilesThree);
FileAssociation association = fileAssociationMapper.selectByExample(example).get(0); FileAssociation association = fileAssociationMapper.selectByExample(example).getFirst();
//先把文件id改成别的测试完成改回来 //先把文件id改成别的测试完成改回来
association.setFileId(IDGenerator.nextStr()); association.setFileId(IDGenerator.nextStr());
association.setFileRefId(association.getFileId()); association.setFileRefId(association.getFileId());

View File

@ -57,7 +57,7 @@ public class CleanUpReportJob {
List<ProjectApplication> testPlan = projectApplicationMapper.selectByExample(applicationExample); List<ProjectApplication> testPlan = projectApplicationMapper.selectByExample(applicationExample);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
if (CollectionUtils.isNotEmpty(testPlan)) { if (CollectionUtils.isNotEmpty(testPlan)) {
map.put(ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name(), testPlan.get(0).getTypeValue()); map.put(ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name(), testPlan.getFirst().getTypeValue());
} else { } else {
map.put(ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name(), "3M"); map.put(ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name(), "3M");
} }
@ -67,7 +67,7 @@ public class CleanUpReportJob {
applicationExample.createCriteria().andProjectIdEqualTo(project.getId()).andTypeEqualTo(ProjectApplicationType.API.API_CLEAN_REPORT.name()); applicationExample.createCriteria().andProjectIdEqualTo(project.getId()).andTypeEqualTo(ProjectApplicationType.API.API_CLEAN_REPORT.name());
List<ProjectApplication> api = projectApplicationMapper.selectByExample(applicationExample); List<ProjectApplication> api = projectApplicationMapper.selectByExample(applicationExample);
if (CollectionUtils.isNotEmpty(api)) { if (CollectionUtils.isNotEmpty(api)) {
map.put(ProjectApplicationType.API.API_CLEAN_REPORT.name(), api.get(0).getTypeValue()); map.put(ProjectApplicationType.API.API_CLEAN_REPORT.name(), api.getFirst().getTypeValue());
} else { } else {
map.put(ProjectApplicationType.API.API_CLEAN_REPORT.name(), "3M"); map.put(ProjectApplicationType.API.API_CLEAN_REPORT.name(), "3M");
} }

View File

@ -183,7 +183,7 @@ public class OperationLogAspect {
mergeLists(beforeValues.get(), (List<LogDTO>) obj); mergeLists(beforeValues.get(), (List<LogDTO>) obj);
} else if (obj instanceof LogDTO log) { } else if (obj instanceof LogDTO log) {
if (CollectionUtils.isNotEmpty(beforeValues.get())) { if (CollectionUtils.isNotEmpty(beforeValues.get())) {
beforeValues.get().get(0).setModifiedValue(log.getOriginalValue()); beforeValues.get().getFirst().setModifiedValue(log.getOriginalValue());
} else { } else {
beforeValues.set(new ArrayList<>() {{ beforeValues.set(new ArrayList<>() {{
this.add(log); this.add(log);
@ -231,7 +231,7 @@ public class OperationLogAspect {
// 单条存储 // 单条存储
if (logDTOList.size() == 1) { if (logDTOList.size() == 1) {
operationLogService.add(logDTOList.get(0)); operationLogService.add(logDTOList.getFirst());
} else { } else {
operationLogService.batchAdd(logDTOList); operationLogService.batchAdd(logDTOList);
} }

View File

@ -52,7 +52,7 @@ public class ApiPluginService {
protocolDTO.setProtocol(protocolPlugin.getProtocol()); protocolDTO.setProtocol(protocolPlugin.getProtocol());
protocolDTO.setPluginId(pluginWrapper.getPluginId()); protocolDTO.setPluginId(pluginWrapper.getPluginId());
if (CollectionUtils.isNotEmpty(extensionClasses)) { if (CollectionUtils.isNotEmpty(extensionClasses)) {
protocolDTO.setPolymorphicName(extensionClasses.get(0).getSimpleName()); protocolDTO.setPolymorphicName(extensionClasses.getFirst().getSimpleName());
} }
if (StringUtils.isNoneBlank(protocolDTO.getProtocol(), protocolDTO.getPolymorphicName())) { if (StringUtils.isNoneBlank(protocolDTO.getProtocol(), protocolDTO.getPolymorphicName())) {
protocols.add(protocolDTO); protocols.add(protocolDTO);

View File

@ -96,7 +96,7 @@ public class BaseStatusItemService {
if (CollectionUtils.isEmpty(statusItems)) { if (CollectionUtils.isEmpty(statusItems)) {
return List.of(); return List.of();
} }
int pos = getByScopeIdAndScene(statusItems.get(0).getScopeId(), statusItems.get(0).getScene()).size(); int pos = getByScopeIdAndScene(statusItems.getFirst().getScopeId(), statusItems.getFirst().getScene()).size();
for (StatusItem statusItem : statusItems) { for (StatusItem statusItem : statusItems) {
statusItem.setId(IDGenerator.nextStr()); statusItem.setId(IDGenerator.nextStr());
// 设置排序 // 设置排序

View File

@ -252,11 +252,11 @@ public class BaseUserRoleService {
List<UserRoleRelation> addRelations = new ArrayList<>(); List<UserRoleRelation> addRelations = new ArrayList<>();
userRoleRelationMap.forEach((groupId, relations) -> { userRoleRelationMap.forEach((groupId, relations) -> {
// 如果当前用户组只有一个用户并且就是要删除的用户组则添加组织成员等默认用户组 // 如果当前用户组只有一个用户并且就是要删除的用户组则添加组织成员等默认用户组
if (relations.size() == 1 && StringUtils.equals(relations.get(0).getRoleId(), roleId)) { if (relations.size() == 1 && StringUtils.equals(relations.getFirst().getRoleId(), roleId)) {
UserRoleRelation relation = new UserRoleRelation(); UserRoleRelation relation = new UserRoleRelation();
relation.setId(IDGenerator.nextStr()); relation.setId(IDGenerator.nextStr());
relation.setUserId(relations.get(0).getUserId()); relation.setUserId(relations.getFirst().getUserId());
relation.setSourceId(relations.get(0).getSourceId()); relation.setSourceId(relations.getFirst().getSourceId());
relation.setRoleId(defaultRoleId); relation.setRoleId(defaultRoleId);
relation.setCreateTime(System.currentTimeMillis()); relation.setCreateTime(System.currentTimeMillis());
relation.setCreateUser(currentUserId); relation.setCreateUser(currentUserId);

View File

@ -88,10 +88,10 @@ public class CommonProjectService {
List<Project> project = projectMapper.selectByExample(example); List<Project> project = projectMapper.selectByExample(example);
ProjectDTO projectDTO = new ProjectDTO(); ProjectDTO projectDTO = new ProjectDTO();
if (CollectionUtils.isNotEmpty(project)) { if (CollectionUtils.isNotEmpty(project)) {
BeanUtils.copyBean(projectDTO, project.get(0)); BeanUtils.copyBean(projectDTO, project.getFirst());
projectDTO.setOrganizationName(organizationMapper.selectByPrimaryKey(projectDTO.getOrganizationId()).getName()); projectDTO.setOrganizationName(organizationMapper.selectByPrimaryKey(projectDTO.getOrganizationId()).getName());
List<ProjectDTO> projectDTOS = buildUserInfo(List.of(projectDTO)); List<ProjectDTO> projectDTOS = buildUserInfo(List.of(projectDTO));
projectDTO = projectDTOS.get(0); projectDTO = projectDTOS.getFirst();
} else { } else {
return null; return null;
} }

View File

@ -87,7 +87,7 @@ public class MessageDetailService {
messageTaskGroup.forEach((messageTaskId, messageTaskList) -> { messageTaskGroup.forEach((messageTaskId, messageTaskList) -> {
//获取同一任务所有的接收人 //获取同一任务所有的接收人
MessageDetail messageDetail = new MessageDetail(); MessageDetail messageDetail = new MessageDetail();
MessageTask messageTask = messageTaskList.get(0); MessageTask messageTask = messageTaskList.getFirst();
messageDetail.setReceiverIds(messageTask.getReceivers()); messageDetail.setReceiverIds(messageTask.getReceivers());
messageDetail.setTaskType(messageTask.getTaskType()); messageDetail.setTaskType(messageTask.getTaskType());
messageDetail.setEvent(messageTask.getEvent()); messageDetail.setEvent(messageTask.getEvent());

View File

@ -352,7 +352,7 @@ public class OrganizationService {
OrganizationExample example = new OrganizationExample(); OrganizationExample example = new OrganizationExample();
example.createCriteria().andNumEqualTo(100001L); example.createCriteria().andNumEqualTo(100001L);
List<Organization> organizations = organizationMapper.selectByExample(example); List<Organization> organizations = organizationMapper.selectByExample(example);
Organization organization = organizations.get(0); Organization organization = organizations.getFirst();
BeanUtils.copyBean(organizationDTO, organization); BeanUtils.copyBean(organizationDTO, organization);
return organizationDTO; return organizationDTO;
} }

View File

@ -62,7 +62,7 @@ public class OrganizationUserRoleLogService {
UserRoleExample example = new UserRoleExample(); UserRoleExample example = new UserRoleExample();
example.createCriteria().andIdEqualTo(request.getId()); example.createCriteria().andIdEqualTo(request.getId());
UserRole userRole = userRoleMapper.selectByExample(example).get(0); UserRole userRole = userRoleMapper.selectByExample(example).getFirst();
dto.setOriginalValue(JSON.toJSONBytes(userRole.getName())); dto.setOriginalValue(JSON.toJSONBytes(userRole.getName()));
dto.setModifiedValue(JSON.toJSONBytes(request.getName())); dto.setModifiedValue(JSON.toJSONBytes(request.getName()));
return dto; return dto;

View File

@ -99,7 +99,7 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
} }
public void removeMember(OrganizationUserRoleMemberEditRequest request) { public void removeMember(OrganizationUserRoleMemberEditRequest request) {
String removeUserId = request.getUserIds().get(0); String removeUserId = request.getUserIds().getFirst();
checkMemberParam(removeUserId, request.getUserRoleId()); checkMemberParam(removeUserId, request.getUserRoleId());
//检查移除的是不是管理员 //检查移除的是不是管理员
if (StringUtils.equals(request.getUserRoleId(),InternalUserRole.ORG_ADMIN.getValue())) { if (StringUtils.equals(request.getUserRoleId(),InternalUserRole.ORG_ADMIN.getValue())) {

View File

@ -54,7 +54,7 @@ public class PlatformPluginService {
ServiceIntegrationExample example = new ServiceIntegrationExample(); ServiceIntegrationExample example = new ServiceIntegrationExample();
example.createCriteria().andPluginIdEqualTo(pluginId).andOrganizationIdEqualTo(orgId); example.createCriteria().andPluginIdEqualTo(pluginId).andOrganizationIdEqualTo(orgId);
List<ServiceIntegration> serviceIntegrations = serviceIntegrationMapper.selectByExampleWithBLOBs(example); List<ServiceIntegration> serviceIntegrations = serviceIntegrationMapper.selectByExampleWithBLOBs(example);
return CollectionUtils.isEmpty(serviceIntegrations) ? null : serviceIntegrations.get(0); return CollectionUtils.isEmpty(serviceIntegrations) ? null : serviceIntegrations.getFirst();
} }
public List<Plugin> getOrgEnabledPlatformPlugins(String orgId) { public List<Plugin> getOrgEnabledPlatformPlugins(String orgId) {

View File

@ -288,7 +288,7 @@ public class PluginLoadService {
*/ */
public <T> Class<? extends T> getExtensionsClass(Class<T> clazz, String pluginId) { public <T> Class<? extends T> getExtensionsClass(Class<T> clazz, String pluginId) {
List<Class<? extends T>> classes = msPluginManager.getExtensionClasses(clazz, pluginId); List<Class<? extends T>> classes = msPluginManager.getExtensionClasses(clazz, pluginId);
return CollectionUtils.isEmpty(classes) ? null : classes.get(0); return CollectionUtils.isEmpty(classes) ? null : classes.getFirst();
} }
public MsPluginManager getMsPluginManager() { public MsPluginManager getMsPluginManager() {

View File

@ -59,7 +59,7 @@ public class SystemParameterService {
List<SystemParameter> baseUrlParameterList = systemParameterMapper.selectByExample(example); List<SystemParameter> baseUrlParameterList = systemParameterMapper.selectByExample(example);
String oldBaseUrl = null; String oldBaseUrl = null;
if (CollectionUtils.isNotEmpty(baseUrlParameterList)) { if (CollectionUtils.isNotEmpty(baseUrlParameterList)) {
SystemParameter parameter = baseUrlParameterList.get(0); SystemParameter parameter = baseUrlParameterList.getFirst();
if (!StringUtils.equals(parameter.getParamValue(), param.getParamValue())) { if (!StringUtils.equals(parameter.getParamValue(), param.getParamValue())) {
oldBaseUrl = parameter.getParamValue(); oldBaseUrl = parameter.getParamValue();
systemParameterMapper.updateByPrimaryKey(param); systemParameterMapper.updateByPrimaryKey(param);
@ -329,7 +329,7 @@ public class SystemParameterService {
public String getApiConcurrentConfig() { public String getApiConcurrentConfig() {
List<SystemParameter> paramList = this.getParamList(ParamConstants.ApiConcurrentConfig.API_CONCURRENT_CONFIG.getValue()); List<SystemParameter> paramList = this.getParamList(ParamConstants.ApiConcurrentConfig.API_CONCURRENT_CONFIG.getValue());
if (CollectionUtils.isNotEmpty(paramList)) { if (CollectionUtils.isNotEmpty(paramList)) {
return paramList.get(0).getParamValue(); return paramList.getFirst().getParamValue();
} }
return DEFAULT_API_CONCURRENT_CONFIG; return DEFAULT_API_CONCURRENT_CONFIG;
} }

View File

@ -50,7 +50,7 @@ public class UserInviteService {
example.createCriteria().andIdEqualTo(id).andInviteTimeGreaterThanOrEqualTo(time); example.createCriteria().andIdEqualTo(id).andInviteTimeGreaterThanOrEqualTo(time);
List<UserInvite> userInvites = userInviteMapper.selectByExampleWithBLOBs(example); List<UserInvite> userInvites = userInviteMapper.selectByExampleWithBLOBs(example);
if (CollectionUtils.isNotEmpty(userInvites)) { if (CollectionUtils.isNotEmpty(userInvites)) {
return userInvites.get(0); return userInvites.getFirst();
} else { } else {
return null; return null;
} }

View File

@ -107,7 +107,7 @@ public class UserKeyService {
userKeyExample.createCriteria().andAccessKeyEqualTo(accessKey).andEnableEqualTo(true); userKeyExample.createCriteria().andAccessKeyEqualTo(accessKey).andEnableEqualTo(true);
List<UserKey> userKeysList = userKeyMapper.selectByExample(userKeyExample); List<UserKey> userKeysList = userKeyMapper.selectByExample(userKeyExample);
if (!CollectionUtils.isEmpty(userKeysList)) { if (!CollectionUtils.isEmpty(userKeysList)) {
return userKeysList.get(0); return userKeysList.getFirst();
} }
return null; return null;
} }

View File

@ -167,7 +167,7 @@ public class UserLoginService {
organizationExample.createCriteria().andIdIn(orgIds).andEnableEqualTo(true); organizationExample.createCriteria().andIdIn(orgIds).andEnableEqualTo(true);
List<Organization> organizationsList = organizationMapper.selectByExample(organizationExample); List<Organization> organizationsList = organizationMapper.selectByExample(organizationExample);
if (CollectionUtils.isNotEmpty(organizationsList)) { if (CollectionUtils.isNotEmpty(organizationsList)) {
String wsId = organizationsList.get(0).getId(); String wsId = organizationsList.getFirst().getId();
switchUserResource(wsId, user); switchUserResource(wsId, user);
} }
} else { } else {
@ -178,7 +178,7 @@ public class UserLoginService {
} }
} else { } else {
UserRoleRelation userRoleRelation = project.stream().filter(p -> StringUtils.isNotBlank(p.getSourceId())) UserRoleRelation userRoleRelation = project.stream().filter(p -> StringUtils.isNotBlank(p.getSourceId()))
.toList().get(0); .toList().getFirst();
String projectId = userRoleRelation.getSourceId(); String projectId = userRoleRelation.getSourceId();
Project p = projectMapper.selectByPrimaryKey(projectId); Project p = projectMapper.selectByPrimaryKey(projectId);
String wsId = p.getOrganizationId(); String wsId = p.getOrganizationId();
@ -199,7 +199,7 @@ public class UserLoginService {
example.createCriteria().andIdEqualTo(user.getLastProjectId()).andEnableEqualTo(true); example.createCriteria().andIdEqualTo(user.getLastProjectId()).andEnableEqualTo(true);
List<Project> projects = projectMapper.selectByExample(example); List<Project> projects = projectMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(projects)) { if (CollectionUtils.isNotEmpty(projects)) {
Project project = projects.get(0); Project project = projects.getFirst();
if (StringUtils.equals(project.getOrganizationId(), user.getLastOrganizationId())) { if (StringUtils.equals(project.getOrganizationId(), user.getLastOrganizationId())) {
return true; return true;
} }
@ -221,7 +221,7 @@ public class UserLoginService {
example.createCriteria().andIdEqualTo(user.getLastProjectId()).andEnableEqualTo(true); example.createCriteria().andIdEqualTo(user.getLastProjectId()).andEnableEqualTo(true);
List<Project> projects = projectMapper.selectByExample(example); List<Project> projects = projectMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(projects)) { if (CollectionUtils.isNotEmpty(projects)) {
Project project = projects.get(0); Project project = projects.getFirst();
if (StringUtils.equals(project.getOrganizationId(), user.getLastOrganizationId())) { if (StringUtils.equals(project.getOrganizationId(), user.getLastOrganizationId())) {
return true; return true;
} }
@ -307,7 +307,7 @@ public class UserLoginService {
updateUser(user); updateUser(user);
return true; return true;
} }
Optional<Project> first = projects.stream().filter(p -> StringUtils.equals(intersection.get(0), p.getId())).findFirst(); Optional<Project> first = projects.stream().filter(p -> StringUtils.equals(intersection.getFirst(), p.getId())).findFirst();
if (first.isPresent()) { if (first.isPresent()) {
Project project = first.get(); Project project = first.get();
String wsId = project.getOrganizationId(); String wsId = project.getOrganizationId();
@ -332,7 +332,7 @@ public class UserLoginService {
user.setLastProjectId(StringUtils.EMPTY); user.setLastProjectId(StringUtils.EMPTY);
List<Project> projects = getProjectListByWsAndUserId(sessionUser.getId(), sourceId); List<Project> projects = getProjectListByWsAndUserId(sessionUser.getId(), sourceId);
if (CollectionUtils.isNotEmpty(projects)) { if (CollectionUtils.isNotEmpty(projects)) {
user.setLastProjectId(projects.get(0).getId()); user.setLastProjectId(projects.getFirst().getId());
} }
BeanUtils.copyProperties(user, newUser); BeanUtils.copyProperties(user, newUser);
// 切换组织或组织之后更新 session 里的 user // 切换组织或组织之后更新 session 里的 user
@ -363,7 +363,7 @@ public class UserLoginService {
// 如果传入的 last_project_id last_organization_id 下面的 // 如果传入的 last_project_id last_organization_id 下面的
boolean present = projects.stream().anyMatch(p -> StringUtils.equals(p.getId(), user.getLastProjectId())); boolean present = projects.stream().anyMatch(p -> StringUtils.equals(p.getId(), user.getLastProjectId()));
if (!present) { if (!present) {
user.setLastProjectId(projects.get(0).getId()); user.setLastProjectId(projects.getFirst().getId());
} }
} else { } else {
user.setLastProjectId(StringUtils.EMPTY); user.setLastProjectId(StringUtils.EMPTY);
@ -411,7 +411,7 @@ public class UserLoginService {
return null; return null;
} }
return getUserDTO(users.get(0).getId()); return getUserDTO(users.getFirst().getId());
} }
public boolean checkUserPassword(String userId, String password) { public boolean checkUserPassword(String userId, String password) {

View File

@ -348,7 +348,7 @@ public abstract class BaseTest {
if (CollectionUtils.isEmpty(listObject)) { if (CollectionUtils.isEmpty(listObject)) {
continue; continue;
} }
if (listObject.get(0) instanceof File || listObject.get(0) instanceof MockMultipartFile) { if (listObject.getFirst() instanceof File || listObject.getFirst() instanceof MockMultipartFile) {
// 参数是多个文件时,设置多个文件 // 参数是多个文件时,设置多个文件
for (Object subObject : ((List) o)) { for (Object subObject : ((List) o)) {
multipartFile = getMockMultipartFile(key, subObject); multipartFile = getMockMultipartFile(key, subObject);
@ -594,7 +594,7 @@ public abstract class BaseTest {
*/ */
private void requestPermissionsTest(List<String> permissionIds, String url, Supplier<MockHttpServletRequestBuilder> requestBuilderGetFunc) throws Exception { private void requestPermissionsTest(List<String> permissionIds, String url, Supplier<MockHttpServletRequestBuilder> requestBuilderGetFunc) throws Exception {
// 相同的用户组 // 相同的用户组
String roleId = permissionIds.get(0).split("_")[0]; String roleId = permissionIds.getFirst().split("_")[0];
for (String permissionId : permissionIds) { for (String permissionId : permissionIds) {
// 多个权限插入同一个用户组 // 多个权限插入同一个用户组
initUserRolePermission(roleId, permissionId); initUserRolePermission(roleId, permissionId);
@ -669,15 +669,15 @@ public abstract class BaseTest {
} }
protected void requestPostPermissionsTest(List<String> permissionIds, String url, Object param, Object... uriVariables) throws Exception { protected void requestPostPermissionsTest(List<String> permissionIds, String url, Object param, Object... uriVariables) throws Exception {
requestPermissionsTest(permissionIds, url, () -> getPermissionPostRequestBuilder(permissionIds.get(0).split("_")[0], url, param, uriVariables)); requestPermissionsTest(permissionIds, url, () -> getPermissionPostRequestBuilder(permissionIds.getFirst().split("_")[0], url, param, uriVariables));
} }
protected void requestGetPermissionsTest(List<String> permissionIds, String url, Object... uriVariables) throws Exception { protected void requestGetPermissionsTest(List<String> permissionIds, String url, Object... uriVariables) throws Exception {
requestPermissionsTest(permissionIds, url, () -> getPermissionRequestBuilder(permissionIds.get(0).split("_")[0], url, uriVariables)); requestPermissionsTest(permissionIds, url, () -> getPermissionRequestBuilder(permissionIds.getFirst().split("_")[0], url, uriVariables));
} }
protected void requestMultipartPermissionsTest(List<String> permissionIds, String url, MultiValueMap<String, Object> paramMap, Object... uriVariables) throws Exception { protected void requestMultipartPermissionsTest(List<String> permissionIds, String url, MultiValueMap<String, Object> paramMap, Object... uriVariables) throws Exception {
requestPermissionsTest(permissionIds, url, () -> getPermissionMultipartRequestBuilder(permissionIds.get(0).split("_")[0], url, paramMap, uriVariables)); requestPermissionsTest(permissionIds, url, () -> getPermissionMultipartRequestBuilder(permissionIds.getFirst().split("_")[0], url, paramMap, uriVariables));
} }
protected ResultActions requestGetWithNoAdmin(String url, String userRoleType, Object... uriVariables) throws Exception { protected ResultActions requestGetWithNoAdmin(String url, String userRoleType, Object... uriVariables) throws Exception {

View File

@ -78,13 +78,13 @@ public class CommonNoticeSendServiceTests extends BaseTest {
FunctionalCaseCustomFieldExample functionalCaseCustomFieldExample = new FunctionalCaseCustomFieldExample(); FunctionalCaseCustomFieldExample functionalCaseCustomFieldExample = new FunctionalCaseCustomFieldExample();
functionalCaseCustomFieldExample.createCriteria().andCaseIdEqualTo("aspect_gyq_one"); functionalCaseCustomFieldExample.createCriteria().andCaseIdEqualTo("aspect_gyq_one");
List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(functionalCaseCustomFieldExample); List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(functionalCaseCustomFieldExample);
String fieldId = functionalCaseCustomFields.get(0).getFieldId(); String fieldId = functionalCaseCustomFields.getFirst().getFieldId();
CustomField customFields = customFieldMapper.selectByPrimaryKey(fieldId); CustomField customFields = customFieldMapper.selectByPrimaryKey(fieldId);
List<OptionDTO>optionDTOList = new ArrayList<>(); List<OptionDTO>optionDTOList = new ArrayList<>();
OptionDTO optionDTO = new OptionDTO(); OptionDTO optionDTO = new OptionDTO();
optionDTO.setId(customFields.getName()); optionDTO.setId(customFields.getName());
optionDTO.setName(functionalCaseCustomFields.get(0).getValue()); optionDTO.setName(functionalCaseCustomFields.getFirst().getValue());
optionDTOList.add(optionDTO); optionDTOList.add(optionDTO);
FunctionalCaseDTO functionalCaseDTO = new FunctionalCaseDTO(); FunctionalCaseDTO functionalCaseDTO = new FunctionalCaseDTO();
BeanUtils.copyBean(functionalCaseDTO,functionalCase); BeanUtils.copyBean(functionalCaseDTO,functionalCase);

View File

@ -320,7 +320,7 @@ class GlobalUserRoleControllerTests extends BaseTest {
example.createCriteria().andUserIdEqualTo(userRoleRelation.getUserId()); example.createCriteria().andUserIdEqualTo(userRoleRelation.getUserId());
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(example); List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(example);
Assertions.assertTrue(userRoleRelations.size() == 1); Assertions.assertTrue(userRoleRelations.size() == 1);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(userRoleRelations.get(0).getRoleId(), MEMBER.getValue())); Assertions.assertTrue(StringUtils.equalsIgnoreCase(userRoleRelations.getFirst().getRoleId(), MEMBER.getValue()));
clearOneLimitTest(userRoleRelation.getUserId()); clearOneLimitTest(userRoleRelation.getUserId());
// 删除没有关联用户的用户组 // 删除没有关联用户的用户组

View File

@ -121,7 +121,7 @@ class GlobalUserRoleRelationControllerTests extends BaseTest {
this.requestPostWithOk(DEFAULT_ADD, request); this.requestPostWithOk(DEFAULT_ADD, request);
List<UserRoleRelation> userRoleRelations = getUserRoleRelationByRoleIdAndUserId(request.getRoleId(), ADMIN.getValue()); List<UserRoleRelation> userRoleRelations = getUserRoleRelationByRoleIdAndUserId(request.getRoleId(), ADMIN.getValue());
Assertions.assertTrue(CollectionUtils.isNotEmpty(userRoleRelations)); Assertions.assertTrue(CollectionUtils.isNotEmpty(userRoleRelations));
addUserRoleRelation = userRoleRelations.get(0); addUserRoleRelation = userRoleRelations.getFirst();
Assertions.assertEquals(addUserRoleRelation.getOrganizationId(), UserRoleScope.SYSTEM); Assertions.assertEquals(addUserRoleRelation.getOrganizationId(), UserRoleScope.SYSTEM);
// @@校验日志 // @@校验日志
@ -218,7 +218,7 @@ class GlobalUserRoleRelationControllerTests extends BaseTest {
// @@删除admin系统管理员用户组异常 // @@删除admin系统管理员用户组异常
List<UserRoleRelation> userRoleRelations = getUserRoleRelationByRoleIdAndUserId(ADMIN.getValue(), ADMIN.getValue()); List<UserRoleRelation> userRoleRelations = getUserRoleRelationByRoleIdAndUserId(ADMIN.getValue(), ADMIN.getValue());
assertErrorCode(this.requestGet(DEFAULT_DELETE, userRoleRelations.get(0).getId()), assertErrorCode(this.requestGet(DEFAULT_DELETE, userRoleRelations.getFirst().getId()),
USER_ROLE_RELATION_REMOVE_ADMIN_USER_PERMISSION); USER_ROLE_RELATION_REMOVE_ADMIN_USER_PERMISSION);
// @@校验 NOT_FOUND 异常 // @@校验 NOT_FOUND 异常

View File

@ -91,7 +91,7 @@ public class NotificationControllerTests extends BaseTest {
NotificationExample notificationExample = new NotificationExample(); NotificationExample notificationExample = new NotificationExample();
notificationExample.createCriteria().andStatusEqualTo(NotificationConstants.Status.UNREAD.name()); notificationExample.createCriteria().andStatusEqualTo(NotificationConstants.Status.UNREAD.name());
List<Notification> notifications = notificationMapper.selectByExample(notificationExample); List<Notification> notifications = notificationMapper.selectByExample(notificationExample);
this.requestGetWithOkAndReturn(NOTIFICATION_READ + notifications.get(0).getId()); this.requestGetWithOkAndReturn(NOTIFICATION_READ + notifications.getFirst().getId());
notificationExample = new NotificationExample(); notificationExample = new NotificationExample();
notificationExample.createCriteria().andStatusEqualTo(NotificationConstants.Status.READ.name()); notificationExample.createCriteria().andStatusEqualTo(NotificationConstants.Status.READ.name());
List<Notification> readNotifications = notificationMapper.selectByExample(notificationExample); List<Notification> readNotifications = notificationMapper.selectByExample(notificationExample);

View File

@ -500,7 +500,7 @@ public class OrganizationControllerTests extends BaseTest {
// 返回的数据量不超过规定要返回的数据量相同 // 返回的数据量不超过规定要返回的数据量相同
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
// 返回值中取出第一条数据, 并判断是否包含关键字admin // 返回值中取出第一条数据, 并判断是否包含关键字admin
OrgUserExtend orgUserExtend = JSON.parseArray(JSON.toJSONString(pageData.getList()), OrgUserExtend.class).get(0); OrgUserExtend orgUserExtend = JSON.parseArray(JSON.toJSONString(pageData.getList()), OrgUserExtend.class).getFirst();
if (StringUtils.isNotBlank(keyWord)) { if (StringUtils.isNotBlank(keyWord)) {
Assertions.assertTrue(StringUtils.contains(orgUserExtend.getName(), organizationRequest.getKeyword()) Assertions.assertTrue(StringUtils.contains(orgUserExtend.getName(), organizationRequest.getKeyword())
|| StringUtils.contains(orgUserExtend.getEmail(), organizationRequest.getKeyword()) || StringUtils.contains(orgUserExtend.getEmail(), organizationRequest.getKeyword())

View File

@ -199,12 +199,12 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
CustomFieldExample example = new CustomFieldExample(); CustomFieldExample example = new CustomFieldExample();
example.createCriteria().andScopeIdEqualTo(DEFAULT_ORGANIZATION_ID).andNameEqualTo("functional_priority"); example.createCriteria().andScopeIdEqualTo(DEFAULT_ORGANIZATION_ID).andNameEqualTo("functional_priority");
CustomFieldUpdateRequest internalRequest = BeanUtils.copyBean(new CustomFieldUpdateRequest(), customFieldMapper.selectByExample(example).get(0)); CustomFieldUpdateRequest internalRequest = BeanUtils.copyBean(new CustomFieldUpdateRequest(), customFieldMapper.selectByExample(example).getFirst());
internalRequest.setName("aaaa"); internalRequest.setName("aaaa");
this.requestPostWithOk(DEFAULT_UPDATE, internalRequest); this.requestPostWithOk(DEFAULT_UPDATE, internalRequest);
Assertions.assertEquals(customFieldMapper.selectByExample(example).get(0).getInternal(), true); Assertions.assertEquals(customFieldMapper.selectByExample(example).getFirst().getInternal(), true);
// 内置字段名称不能修改 // 内置字段名称不能修改
Assertions.assertEquals(customFieldMapper.selectByExample(example).get(0).getName(), "functional_priority"); Assertions.assertEquals(customFieldMapper.selectByExample(example).getFirst().getName(), "functional_priority");
// @校验是否开启组织模板 // @校验是否开启组织模板
changeOrgTemplateEnable(false); changeOrgTemplateEnable(false);
@ -261,8 +261,8 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
if (StringUtils.equalsAny(resultItem.getType(), CustomFieldType.MEMBER.name(), CustomFieldType.MULTIPLE_MEMBER.name())) { if (StringUtils.equalsAny(resultItem.getType(), CustomFieldType.MEMBER.name(), CustomFieldType.MULTIPLE_MEMBER.name())) {
List<CustomFieldOption> options = customFieldDTO.getOptions(); List<CustomFieldOption> options = customFieldDTO.getOptions();
Assertions.assertEquals(options.size(), 1); Assertions.assertEquals(options.size(), 1);
Assertions.assertEquals(options.get(0).getValue(), "CREATE_USER"); Assertions.assertEquals(options.getFirst().getValue(), "CREATE_USER");
Assertions.assertEquals(options.get(0).getText(), "创建人"); Assertions.assertEquals(options.getFirst().getText(), "创建人");
} else if (CustomFieldType.getHasOptionValueSet().contains(resultItem.getType())) { } else if (CustomFieldType.getHasOptionValueSet().contains(resultItem.getType())) {
// 有下拉框选项的校验选项 // 有下拉框选项的校验选项
Assertions.assertEquals(resultList.get(i).getOptions().stream().sorted(Comparator.comparing(CustomFieldOption::getValue)).toList(), Assertions.assertEquals(resultList.get(i).getOptions().stream().sorted(Comparator.comparing(CustomFieldOption::getValue)).toList(),
@ -321,7 +321,7 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
CustomFieldExample example = new CustomFieldExample(); CustomFieldExample example = new CustomFieldExample();
example.createCriteria() example.createCriteria()
.andInternalEqualTo(true); .andInternalEqualTo(true);
CustomField internalCustomField = customFieldMapper.selectByExample(example).get(0); CustomField internalCustomField = customFieldMapper.selectByExample(example).getFirst();
assertErrorCode(this.requestGet(DEFAULT_DELETE, internalCustomField.getId()), INTERNAL_CUSTOM_FIELD_PERMISSION); assertErrorCode(this.requestGet(DEFAULT_DELETE, internalCustomField.getId()), INTERNAL_CUSTOM_FIELD_PERMISSION);
// @@校验 NOT_FOUND 异常 // @@校验 NOT_FOUND 异常

View File

@ -213,7 +213,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
TemplateExample example = new TemplateExample(); TemplateExample example = new TemplateExample();
example.createCriteria().andScopeIdEqualTo(DEFAULT_ORGANIZATION_ID) example.createCriteria().andScopeIdEqualTo(DEFAULT_ORGANIZATION_ID)
.andSceneEqualTo(TemplateScene.API.name()); .andSceneEqualTo(TemplateScene.API.name());
Template template = templateMapper.selectByExample(example).get(0); Template template = templateMapper.selectByExample(example).getFirst();
TemplateUpdateRequest updateRequest = new TemplateUpdateRequest(); TemplateUpdateRequest updateRequest = new TemplateUpdateRequest();
TemplateCustomFieldRequest templateCustomFieldRequest = new TemplateCustomFieldRequest(); TemplateCustomFieldRequest templateCustomFieldRequest = new TemplateCustomFieldRequest();
templateCustomFieldRequest.setFieldId(customField.getId()); templateCustomFieldRequest.setFieldId(customField.getId());
@ -341,7 +341,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
// 校验日志 // 校验日志
checkLog(projectId, OperationLogType.ADD); checkLog(projectId, OperationLogType.ADD);
compareProjectDTO(projects.get(0), result); compareProjectDTO(projects.getFirst(), result);
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample(); UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue()); userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample); List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
@ -367,7 +367,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
// 校验日志 // 校验日志
checkLog(projectId, OperationLogType.ADD); checkLog(projectId, OperationLogType.ADD);
compareProjectDTO(projects.get(0), result); compareProjectDTO(projects.getFirst(), result);
Assertions.assertNull(projectExtend.getModuleSetting()); Assertions.assertNull(projectExtend.getModuleSetting());
//设置了模块模版 //设置了模块模版
@ -386,7 +386,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
// 校验日志 // 校验日志
checkLog(projectId, OperationLogType.ADD); checkLog(projectId, OperationLogType.ADD);
compareProjectDTO(projects.get(0), result); compareProjectDTO(projects.getFirst(), result);
userRoleRelationExample = new UserRoleRelationExample(); userRoleRelationExample = new UserRoleRelationExample();
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue()); userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample); userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
@ -410,7 +410,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
// 校验日志 // 校验日志
checkLog(projectId, OperationLogType.ADD); checkLog(projectId, OperationLogType.ADD);
compareProjectDTO(projects.get(0), result); compareProjectDTO(projects.getFirst(), result);
//校验资源池 //校验资源池
ProjectTestResourcePoolExample projectTestResourcePoolExample = new ProjectTestResourcePoolExample(); ProjectTestResourcePoolExample projectTestResourcePoolExample = new ProjectTestResourcePoolExample();
projectTestResourcePoolExample.createCriteria().andProjectIdEqualTo(projectId); projectTestResourcePoolExample.createCriteria().andProjectIdEqualTo(projectId);
@ -511,7 +511,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
//第一个数据的createTime是最大的 //第一个数据的createTime是最大的
assert returnPager != null; assert returnPager != null;
List<ProjectDTO> projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class); List<ProjectDTO> projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
long firstCreateTime = projectDTOS.get(0).getCreateTime(); long firstCreateTime = projectDTOS.getFirst().getCreateTime();
for (ProjectDTO projectDTO : projectDTOS) { for (ProjectDTO projectDTO : projectDTOS) {
Assertions.assertFalse(projectDTO.getCreateTime() > firstCreateTime); Assertions.assertFalse(projectDTO.getCreateTime() > firstCreateTime);
} }
@ -537,7 +537,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
//第一个数据的organizationName是最小的 //第一个数据的organizationName是最小的
assert returnPager != null; assert returnPager != null;
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class); projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
String firstOrganizationName = projectDTOS.get(0).getOrganizationName(); String firstOrganizationName = projectDTOS.getFirst().getOrganizationName();
for (ProjectDTO projectDTO : projectDTOS) { for (ProjectDTO projectDTO : projectDTOS) {
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) < 0); Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) < 0);
} }
@ -550,7 +550,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
//第一个数据的organizationName是最大的 //第一个数据的organizationName是最大的
assert returnPager != null; assert returnPager != null;
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class); projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
firstOrganizationName = projectDTOS.get(0).getOrganizationName(); firstOrganizationName = projectDTOS.getFirst().getOrganizationName();
for (ProjectDTO projectDTO : projectDTOS) { for (ProjectDTO projectDTO : projectDTOS) {
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) > 0); Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) > 0);
} }
@ -812,7 +812,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
//第一个数据的createTime是最大的 //第一个数据的createTime是最大的
assert returnPager != null; assert returnPager != null;
List<UserExtendDTO> userExtendDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), UserExtendDTO.class); List<UserExtendDTO> userExtendDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), UserExtendDTO.class);
long firstCreateTime = userExtendDTOS.get(0).getCreateTime(); long firstCreateTime = userExtendDTOS.getFirst().getCreateTime();
for (UserExtendDTO userExtendDTO : userExtendDTOS) { for (UserExtendDTO userExtendDTO : userExtendDTOS) {
Assertions.assertFalse(userExtendDTO.getCreateTime() > firstCreateTime); Assertions.assertFalse(userExtendDTO.getCreateTime() > firstCreateTime);
} }
@ -863,7 +863,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
int count = parseObjectFromMvcResult(mvcResult, Integer.class); int count = parseObjectFromMvcResult(mvcResult, Integer.class);
Assertions.assertEquals(count, userRoleRelations.size()); Assertions.assertEquals(count, userRoleRelations.size());
// 校验日志 // 校验日志
checkLog(userRoleRelations.get(0).getId(), OperationLogType.DELETE); checkLog(userRoleRelations.getFirst().getId(), OperationLogType.DELETE);
// @@校验权限 // @@校验权限
requestGetPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_MEMBER_DELETE, removeProjectMember + projectId + "/" + userId); requestGetPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_MEMBER_DELETE, removeProjectMember + projectId + "/" + userId);
} }

View File

@ -287,7 +287,7 @@ public class OrganizationStatusFlowSettingControllerTest extends BaseTest {
.andInternalEqualTo(true).andNameEqualTo(DefaultBugStatusItemName.REJECTED) .andInternalEqualTo(true).andNameEqualTo(DefaultBugStatusItemName.REJECTED)
.andScopeIdEqualTo(DEFAULT_ORGANIZATION_ID); .andScopeIdEqualTo(DEFAULT_ORGANIZATION_ID);
List<StatusItem> statusItems = statusItemMapper.selectByExample(example); List<StatusItem> statusItems = statusItemMapper.selectByExample(example);
return statusItems.size() == 0 ? null : statusItems.get(0); return statusItems.size() == 0 ? null : statusItems.getFirst();
} }
@Test @Test
@ -353,7 +353,7 @@ public class OrganizationStatusFlowSettingControllerTest extends BaseTest {
.andNameEqualTo(DefaultBugStatusItemName.NEW) .andNameEqualTo(DefaultBugStatusItemName.NEW)
.andScopeIdEqualTo(scopeId); .andScopeIdEqualTo(scopeId);
StatusItemMapper statusItemMapper = CommonBeanFactory.getBean(StatusItemMapper.class); StatusItemMapper statusItemMapper = CommonBeanFactory.getBean(StatusItemMapper.class);
return statusItemMapper.selectByExample(example).get(0); return statusItemMapper.selectByExample(example).getFirst();
} }
public static void assertUpdateStatusDefinition(StatusDefinitionUpdateRequest request) { public static void assertUpdateStatusDefinition(StatusDefinitionUpdateRequest request) {

View File

@ -86,7 +86,7 @@ public class OrganizationTemplateControllerTests extends BaseTest {
// @@校验没有数据的情况 // @@校验没有数据的情况
MvcResult mvcResult = this.requestGetWithOkAndReturn(LIST, DEFAULT_ORGANIZATION_ID, TemplateScene.FUNCTIONAL.name()); MvcResult mvcResult = this.requestGetWithOkAndReturn(LIST, DEFAULT_ORGANIZATION_ID, TemplateScene.FUNCTIONAL.name());
List<Template> templates = getResultDataArray(mvcResult, Template.class); List<Template> templates = getResultDataArray(mvcResult, Template.class);
this.defaultTemplate = templates.get(0); this.defaultTemplate = templates.getFirst();
} }
@Test @Test
@ -264,7 +264,7 @@ public class OrganizationTemplateControllerTests extends BaseTest {
request.setEnableThirdPart(true); request.setEnableThirdPart(true);
request.setCustomFields(new ArrayList<>(0)); request.setCustomFields(new ArrayList<>(0));
request.setSystemFields(getTemplateSystemCustomFieldRequests()); request.setSystemFields(getTemplateSystemCustomFieldRequests());
request.getSystemFields().get(0).setDefaultValue("update"); request.getSystemFields().getFirst().setDefaultValue("update");
this.requestPostWithOk(DEFAULT_UPDATE, request); this.requestPostWithOk(DEFAULT_UPDATE, request);
Template template = templateMapper.selectByPrimaryKey(request.getId()); Template template = templateMapper.selectByPrimaryKey(request.getId());
// 校验请求成功数据 // 校验请求成功数据
@ -428,7 +428,7 @@ public class OrganizationTemplateControllerTests extends BaseTest {
example.createCriteria() example.createCriteria()
.andScopeTypeEqualTo(TemplateScopeType.ORGANIZATION.name()) .andScopeTypeEqualTo(TemplateScopeType.ORGANIZATION.name())
.andInternalEqualTo(true); .andInternalEqualTo(true);
Template internalTemplate = templateMapper.selectByExample(example).get(0); Template internalTemplate = templateMapper.selectByExample(example).getFirst();
assertErrorCode(this.requestGet(DEFAULT_DELETE, internalTemplate.getId()), INTERNAL_TEMPLATE_PERMISSION); assertErrorCode(this.requestGet(DEFAULT_DELETE, internalTemplate.getId()), INTERNAL_TEMPLATE_PERMISSION);
// @@校验 NOT_FOUND 异常 // @@校验 NOT_FOUND 异常

View File

@ -272,7 +272,7 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
// 返回值中取出第一条数据, 并判断是否包含关键字 // 返回值中取出第一条数据, 并判断是否包含关键字
List<User> userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class); List<User> userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class);
if(CollectionUtils.isNotEmpty(userList)) { if(CollectionUtils.isNotEmpty(userList)) {
User user = userList.get(0); User user = userList.getFirst();
Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword()) Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword())
|| StringUtils.contains(user.getId(), request.getKeyword())); || StringUtils.contains(user.getId(), request.getKeyword()));
} }

View File

@ -187,7 +187,7 @@ public class ServiceIntegrationControllerTests extends BaseTest {
MvcResult mvcResult = this.requestGetWithOkAndReturn(LIST, defaultOrg.getId()); MvcResult mvcResult = this.requestGetWithOkAndReturn(LIST, defaultOrg.getId());
// 校验请求成功数据 // 校验请求成功数据
List<ServiceIntegrationDTO> serviceIntegrationList = getResultDataArray(mvcResult, ServiceIntegrationDTO.class); List<ServiceIntegrationDTO> serviceIntegrationList = getResultDataArray(mvcResult, ServiceIntegrationDTO.class);
ServiceIntegrationDTO serviceIntegrationDTO = serviceIntegrationList.get(0); ServiceIntegrationDTO serviceIntegrationDTO = serviceIntegrationList.getFirst();
ServiceIntegration serviceIntegration = serviceIntegrationMapper.selectByPrimaryKey(serviceIntegrationDTO.getId()); ServiceIntegration serviceIntegration = serviceIntegrationMapper.selectByPrimaryKey(serviceIntegrationDTO.getId());
Assertions.assertEquals(JSON.parseMap(new String(serviceIntegration.getConfiguration())), Assertions.assertEquals(JSON.parseMap(new String(serviceIntegration.getConfiguration())),
serviceIntegrationDTO.getConfiguration()); serviceIntegrationDTO.getConfiguration());

View File

@ -76,7 +76,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
// 返回的数据量不超过规定要返回的数据量相同 // 返回的数据量不超过规定要返回的数据量相同
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
// 返回值中取出第一条数据, 并判断是否包含关键字default // 返回值中取出第一条数据, 并判断是否包含关键字default
OrganizationDTO organizationDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), OrganizationDTO.class).get(0); OrganizationDTO organizationDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), OrganizationDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(organizationDTO.getName(), organizationRequest.getKeyword()) Assertions.assertTrue(StringUtils.contains(organizationDTO.getName(), organizationRequest.getKeyword())
|| StringUtils.contains(organizationDTO.getId(), organizationRequest.getKeyword())); || StringUtils.contains(organizationDTO.getId(), organizationRequest.getKeyword()));
@ -89,7 +89,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class); ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class); Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
// 返回值中取出第一条ID最大的数据, 并判断是否是default-organization-6 // 返回值中取出第一条ID最大的数据, 并判断是否是default-organization-6
OrganizationDTO organizationDTO1 = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), OrganizationDTO.class).get(0); OrganizationDTO organizationDTO1 = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), OrganizationDTO.class).getFirst();
Assertions.assertTrue(organizationDTO1.getId().contains("default")); Assertions.assertTrue(organizationDTO1.getId().contains("default"));
// 权限校验 // 权限校验
requestPostPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, ORGANIZATION_LIST, organizationRequest); requestPostPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, ORGANIZATION_LIST, organizationRequest);
@ -241,7 +241,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
// 返回的数据量不超过规定要返回的数据量相同 // 返回的数据量不超过规定要返回的数据量相同
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
// 返回值中取出第一条数据, 并判断是否包含关键字admin // 返回值中取出第一条数据, 并判断是否包含关键字admin
UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).get(0); UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(userExtendDTO.getName(), organizationRequest.getKeyword()) Assertions.assertTrue(StringUtils.contains(userExtendDTO.getName(), organizationRequest.getKeyword())
|| StringUtils.contains(userExtendDTO.getEmail(), organizationRequest.getKeyword()) || StringUtils.contains(userExtendDTO.getEmail(), organizationRequest.getKeyword())
|| StringUtils.contains(userExtendDTO.getPhone(), organizationRequest.getKeyword())); || StringUtils.contains(userExtendDTO.getPhone(), organizationRequest.getKeyword()));
@ -255,7 +255,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class); ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class); Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
// 返回值中取出第一条ID最大的数据, 并判断是否是admin // 返回值中取出第一条ID最大的数据, 并判断是否是admin
UserExtendDTO userExtendDTO1 = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), UserExtendDTO.class).get(0); UserExtendDTO userExtendDTO1 = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), UserExtendDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(userExtendDTO1.getId(), "admin")); Assertions.assertTrue(StringUtils.contains(userExtendDTO1.getId(), "admin"));
// 权限校验 // 权限校验
requestPostPermissionsTest(List.of(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, PermissionConstants.SYSTEM_USER_READ), requestPostPermissionsTest(List.of(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, PermissionConstants.SYSTEM_USER_READ),
@ -311,7 +311,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
// 返回的数据量不超过规定要返回的数据量相同 // 返回的数据量不超过规定要返回的数据量相同
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
// 返回值中取出第一条数据, 并判断是否包含关键字admin // 返回值中取出第一条数据, 并判断是否包含关键字admin
UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).get(0); UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(userExtendDTO.getName(), organizationRequest.getKeyword()) Assertions.assertTrue(StringUtils.contains(userExtendDTO.getName(), organizationRequest.getKeyword())
|| StringUtils.contains(userExtendDTO.getEmail(), organizationRequest.getKeyword()) || StringUtils.contains(userExtendDTO.getEmail(), organizationRequest.getKeyword())
|| StringUtils.contains(userExtendDTO.getPhone(), organizationRequest.getKeyword())); || StringUtils.contains(userExtendDTO.getPhone(), organizationRequest.getKeyword()));
@ -347,7 +347,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
// 返回的数据量不超过规定要返回的数据量相同 // 返回的数据量不超过规定要返回的数据量相同
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
// 返回值中取出第一条数据, 并判断是否包含关键字admin // 返回值中取出第一条数据, 并判断是否包含关键字admin
UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).get(0); UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).getFirst();
Assertions.assertTrue(StringUtils.contains(userExtendDTO.getName(), organizationRequest.getKeyword()) Assertions.assertTrue(StringUtils.contains(userExtendDTO.getName(), organizationRequest.getKeyword())
|| StringUtils.contains(userExtendDTO.getEmail(), organizationRequest.getKeyword()) || StringUtils.contains(userExtendDTO.getEmail(), organizationRequest.getKeyword())
|| StringUtils.contains(userExtendDTO.getPhone(), organizationRequest.getKeyword())); || StringUtils.contains(userExtendDTO.getPhone(), organizationRequest.getKeyword()));
@ -427,7 +427,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class); ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class); Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
// 返回值中取出第一条ID最大的数据, 并判断是否是default-project // 返回值中取出第一条ID最大的数据, 并判断是否是default-project
ProjectDTO projectDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), ProjectDTO.class).get(0); ProjectDTO projectDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), ProjectDTO.class).getFirst();
Assertions.assertTrue(StringUtils.equals(projectDTO.getId(), "default-project")); Assertions.assertTrue(StringUtils.equals(projectDTO.getId(), "default-project"));
// 权限校验 // 权限校验

View File

@ -335,7 +335,7 @@ public class SystemProjectControllerTests extends BaseTest {
// 校验日志 // 校验日志
checkLog(projectId, OperationLogType.ADD); checkLog(projectId, OperationLogType.ADD);
compareProjectDTO(projects.get(0), result); compareProjectDTO(projects.getFirst(), result);
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample(); UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue()); userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample); List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
@ -364,7 +364,7 @@ public class SystemProjectControllerTests extends BaseTest {
// 校验日志 // 校验日志
checkLog(projectId, OperationLogType.ADD); checkLog(projectId, OperationLogType.ADD);
compareProjectDTO(projects.get(0), result); compareProjectDTO(projects.getFirst(), result);
userRoleRelationExample = new UserRoleRelationExample(); userRoleRelationExample = new UserRoleRelationExample();
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue()); userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample); userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
@ -395,7 +395,7 @@ public class SystemProjectControllerTests extends BaseTest {
// 校验日志 // 校验日志
checkLog(projectId, OperationLogType.ADD); checkLog(projectId, OperationLogType.ADD);
compareProjectDTO(projects.get(0), result); compareProjectDTO(projects.getFirst(), result);
userRoleRelationExample = new UserRoleRelationExample(); userRoleRelationExample = new UserRoleRelationExample();
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue()); userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample); userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
@ -419,7 +419,7 @@ public class SystemProjectControllerTests extends BaseTest {
// 校验日志 // 校验日志
checkLog(projectId, OperationLogType.ADD); checkLog(projectId, OperationLogType.ADD);
compareProjectDTO(projects.get(0), result); compareProjectDTO(projects.getFirst(), result);
//校验资源池 //校验资源池
ProjectTestResourcePoolExample projectTestResourcePoolExample = new ProjectTestResourcePoolExample(); ProjectTestResourcePoolExample projectTestResourcePoolExample = new ProjectTestResourcePoolExample();
projectTestResourcePoolExample.createCriteria().andProjectIdEqualTo(projectId); projectTestResourcePoolExample.createCriteria().andProjectIdEqualTo(projectId);
@ -573,7 +573,7 @@ public class SystemProjectControllerTests extends BaseTest {
// 关联模板 // 关联模板
TemplateUpdateRequest request = new TemplateUpdateRequest(); TemplateUpdateRequest request = new TemplateUpdateRequest();
Template template = baseTemplateService.getTemplates(DEFAULT_ORGANIZATION_ID, scene).get(0); Template template = baseTemplateService.getTemplates(DEFAULT_ORGANIZATION_ID, scene).getFirst();
TemplateCustomFieldRequest templateCustomFieldRequest = new TemplateCustomFieldRequest(); TemplateCustomFieldRequest templateCustomFieldRequest = new TemplateCustomFieldRequest();
templateCustomFieldRequest.setFieldId(customField.getId()); templateCustomFieldRequest.setFieldId(customField.getId());
templateCustomFieldRequest.setRequired(false); templateCustomFieldRequest.setRequired(false);
@ -686,7 +686,7 @@ public class SystemProjectControllerTests extends BaseTest {
//第一个数据的createTime是最大的 //第一个数据的createTime是最大的
assert returnPager != null; assert returnPager != null;
List<ProjectDTO> projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class); List<ProjectDTO> projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
long firstCreateTime = projectDTOS.get(0).getCreateTime(); long firstCreateTime = projectDTOS.getFirst().getCreateTime();
for (ProjectDTO projectDTO : projectDTOS) { for (ProjectDTO projectDTO : projectDTOS) {
Assertions.assertFalse(projectDTO.getCreateTime() > firstCreateTime); Assertions.assertFalse(projectDTO.getCreateTime() > firstCreateTime);
} }
@ -713,7 +713,7 @@ public class SystemProjectControllerTests extends BaseTest {
//第一个数据的organizationName是最小的 //第一个数据的organizationName是最小的
assert returnPager != null; assert returnPager != null;
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class); projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
String firstOrganizationName = projectDTOS.get(0).getOrganizationName(); String firstOrganizationName = projectDTOS.getFirst().getOrganizationName();
for (ProjectDTO projectDTO : projectDTOS) { for (ProjectDTO projectDTO : projectDTOS) {
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) < 0); Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) < 0);
} }
@ -726,7 +726,7 @@ public class SystemProjectControllerTests extends BaseTest {
//第一个数据的organizationName是最大的 //第一个数据的organizationName是最大的
assert returnPager != null; assert returnPager != null;
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class); projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
firstOrganizationName = projectDTOS.get(0).getOrganizationName(); firstOrganizationName = projectDTOS.getFirst().getOrganizationName();
for (ProjectDTO projectDTO : projectDTOS) { for (ProjectDTO projectDTO : projectDTOS) {
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) > 0); Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) > 0);
} }
@ -952,7 +952,7 @@ public class SystemProjectControllerTests extends BaseTest {
returnPager = parseObjectFromMvcResult(mvcResult, Pager.class); returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
//第一个数据的createTime是最大的 //第一个数据的createTime是最大的
List<UserExtendDTO> userExtendDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), UserExtendDTO.class); List<UserExtendDTO> userExtendDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), UserExtendDTO.class);
long firstCreateTime = userExtendDTOS.get(0).getCreateTime(); long firstCreateTime = userExtendDTOS.getFirst().getCreateTime();
for (UserExtendDTO userExtendDTO : userExtendDTOS) { for (UserExtendDTO userExtendDTO : userExtendDTOS) {
Assertions.assertFalse(userExtendDTO.getCreateTime() > firstCreateTime); Assertions.assertFalse(userExtendDTO.getCreateTime() > firstCreateTime);
} }

View File

@ -281,7 +281,7 @@ class TestResourcePoolControllerTests extends BaseTest {
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class); ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class); Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
// 返回值中取出第一条ID最大的数据, 并判断是否是default-admin // 返回值中取出第一条ID最大的数据, 并判断是否是default-admin
TestResourcePoolDTO testResourcePoolDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), TestResourcePoolDTO.class).get(0); TestResourcePoolDTO testResourcePoolDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), TestResourcePoolDTO.class).getFirst();
Assertions.assertNull(testResourcePoolDTO.getInUsed()); Assertions.assertNull(testResourcePoolDTO.getInUsed());
} }
@ -557,7 +557,7 @@ class TestResourcePoolControllerTests extends BaseTest {
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class); ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class); Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
// 返回值中取出第一条ID最大的数据, 并判断是否是default-admin // 返回值中取出第一条ID最大的数据, 并判断是否是default-admin
TestResourcePoolDTO testResourcePoolDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), TestResourcePoolDTO.class).get(0); TestResourcePoolDTO testResourcePoolDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), TestResourcePoolDTO.class).getFirst();
Assertions.assertTrue(StringUtils.equals(testResourcePoolDTO.getName(), keyWord)); Assertions.assertTrue(StringUtils.equals(testResourcePoolDTO.getName(), keyWord));
return testResourcePoolDTO; return testResourcePoolDTO;
} }

View File

@ -77,10 +77,10 @@ public class UserApiKeysControllerTests extends BaseTest {
UserKeyExample userKeyExample = new UserKeyExample(); UserKeyExample userKeyExample = new UserKeyExample();
userKeyExample.createCriteria().andCreateUserEqualTo("admin"); userKeyExample.createCriteria().andCreateUserEqualTo("admin");
List<UserKey> userKeys = userKeyMapper.selectByExample(userKeyExample); List<UserKey> userKeys = userKeyMapper.selectByExample(userKeyExample);
userKeyId = userKeys.get(0).getId(); userKeyId = userKeys.getFirst().getId();
Assertions.assertEquals(1, userKeys.size()); Assertions.assertEquals(1, userKeys.size());
//校验日志 //校验日志
checkLog(userKeys.get(0).getId(), OperationLogType.ADD); checkLog(userKeys.getFirst().getId(), OperationLogType.ADD);
//校验只能加五条的限制 //校验只能加五条的限制
requestGet(ADD); requestGet(ADD);
requestGet(ADD); requestGet(ADD);
@ -111,10 +111,10 @@ public class UserApiKeysControllerTests extends BaseTest {
//选一个id不等于userKeyId的 只要id //选一个id不等于userKeyId的 只要id
//取所有的id //取所有的id
List<String> list = userKeys.stream().map(UserKey::getId).filter(id -> !id.equals(userKeyId)).toList(); List<String> list = userKeys.stream().map(UserKey::getId).filter(id -> !id.equals(userKeyId)).toList();
requestGet(String.format(DELETE, list.get(0))); requestGet(String.format(DELETE, list.getFirst()));
Assertions.assertEquals(4, userKeyMapper.countByExample(userKeyExample)); Assertions.assertEquals(4, userKeyMapper.countByExample(userKeyExample));
//校验日志 //校验日志
checkLog(list.get(0), OperationLogType.DELETE); checkLog(list.getFirst(), OperationLogType.DELETE);
//处理不存在的 //处理不存在的
requestGet(String.format(DELETE, UUID.randomUUID().toString()), status().is5xxServerError()); requestGet(String.format(DELETE, UUID.randomUUID().toString()), status().is5xxServerError());
//校验权限 //校验权限
@ -220,7 +220,7 @@ public class UserApiKeysControllerTests extends BaseTest {
public void testValidate() throws Exception { public void testValidate() throws Exception {
List<UserKey> userKeys = userKeyMapper.selectByExample(new UserKeyExample()); List<UserKey> userKeys = userKeyMapper.selectByExample(new UserKeyExample());
List<String> list = userKeys.stream().map(UserKey::getId).filter(id -> !id.equals(userKeyId)).toList(); List<String> list = userKeys.stream().map(UserKey::getId).filter(id -> !id.equals(userKeyId)).toList();
UserKey userKey1 = userKeyMapper.selectByPrimaryKey(list.get(0)); UserKey userKey1 = userKeyMapper.selectByPrimaryKey(list.getFirst());
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get(VALIDATE); MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get(VALIDATE);
String signature = CodingUtils.aesEncrypt(userKey1.getAccessKey() + "|" + UUID.randomUUID().toString() + "|" + System.currentTimeMillis(), userKey1.getSecretKey(), userKey1.getAccessKey()); String signature = CodingUtils.aesEncrypt(userKey1.getAccessKey() + "|" + UUID.randomUUID().toString() + "|" + System.currentTimeMillis(), userKey1.getSecretKey(), userKey1.getAccessKey());
requestBuilder requestBuilder

View File

@ -84,7 +84,7 @@ public class UserLocalConfigControllerTests extends BaseTest {
public void testUpdate() throws Exception { public void testUpdate() throws Exception {
UserLocalConfigExample userLocalConfigExample = new UserLocalConfigExample(); UserLocalConfigExample userLocalConfigExample = new UserLocalConfigExample();
userLocalConfigExample.createCriteria().andCreateUserEqualTo("admin").andTypeEqualTo("API"); userLocalConfigExample.createCriteria().andCreateUserEqualTo("admin").andTypeEqualTo("API");
UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).get(0); UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).getFirst();
UserLocalConfigUpdateRequest request = new UserLocalConfigUpdateRequest(); UserLocalConfigUpdateRequest request = new UserLocalConfigUpdateRequest();
request.setId(userLocalConfig.getId()); request.setId(userLocalConfig.getId());
request.setUserUrl("https://www.zhihu.com"); request.setUserUrl("https://www.zhihu.com");
@ -107,7 +107,7 @@ public class UserLocalConfigControllerTests extends BaseTest {
public void testEnable() throws Exception { public void testEnable() throws Exception {
UserLocalConfigExample userLocalConfigExample = new UserLocalConfigExample(); UserLocalConfigExample userLocalConfigExample = new UserLocalConfigExample();
userLocalConfigExample.createCriteria().andCreateUserEqualTo("admin").andTypeEqualTo("API"); userLocalConfigExample.createCriteria().andCreateUserEqualTo("admin").andTypeEqualTo("API");
UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).get(0); UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).getFirst();
requestGet(String.format(ENABLE, userLocalConfig.getId())); requestGet(String.format(ENABLE, userLocalConfig.getId()));
userLocalConfig = userLocalConfigMapper.selectByPrimaryKey(userLocalConfig.getId()); userLocalConfig = userLocalConfigMapper.selectByPrimaryKey(userLocalConfig.getId());
Assertions.assertEquals(true, userLocalConfig.getEnable()); Assertions.assertEquals(true, userLocalConfig.getEnable());
@ -122,7 +122,7 @@ public class UserLocalConfigControllerTests extends BaseTest {
public void testDisable() throws Exception { public void testDisable() throws Exception {
UserLocalConfigExample userLocalConfigExample = new UserLocalConfigExample(); UserLocalConfigExample userLocalConfigExample = new UserLocalConfigExample();
userLocalConfigExample.createCriteria().andCreateUserEqualTo("admin").andTypeEqualTo("API"); userLocalConfigExample.createCriteria().andCreateUserEqualTo("admin").andTypeEqualTo("API");
UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).get(0); UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).getFirst();
requestGet(String.format(DISABLE, userLocalConfig.getId())); requestGet(String.format(DISABLE, userLocalConfig.getId()));
userLocalConfig = userLocalConfigMapper.selectByPrimaryKey(userLocalConfig.getId()); userLocalConfig = userLocalConfigMapper.selectByPrimaryKey(userLocalConfig.getId());
Assertions.assertEquals(false, userLocalConfig.getEnable()); Assertions.assertEquals(false, userLocalConfig.getEnable());

View File

@ -87,7 +87,7 @@ public class PersonalControllerTests extends BaseTest {
example.createCriteria().andIdEqualTo(loginUser); example.createCriteria().andIdEqualTo(loginUser);
List<UserExtend> userExtends = userExtendMapper.selectByExample(example); List<UserExtend> userExtends = userExtendMapper.selectByExample(example);
if (!userExtends.isEmpty()) { if (!userExtends.isEmpty()) {
Assertions.assertNull(userExtends.get(0).getAvatar()); Assertions.assertNull(userExtends.getFirst().getAvatar());
} }
request = new PersonalUpdateRequest(); request = new PersonalUpdateRequest();

View File

@ -29,12 +29,12 @@ public class TestResourcePoolServiceTest extends BaseTest {
@Test @Test
public void getTestResourceDTO() { public void getTestResourceDTO() {
testResourcePoolService.getTestResourceDTO(testResourcePoolMapper.selectByExample(new TestResourcePoolExample()).get(0).getId()); testResourcePoolService.getTestResourceDTO(testResourcePoolMapper.selectByExample(new TestResourcePoolExample()).getFirst().getId());
} }
@Test @Test
public void validateOrgResourcePool() { public void validateOrgResourcePool() {
TestResourcePool resourcePool = testResourcePoolMapper.selectByExample(new TestResourcePoolExample()).get(0); TestResourcePool resourcePool = testResourcePoolMapper.selectByExample(new TestResourcePoolExample()).getFirst();
testResourcePoolService.getTestResourcePool(resourcePool.getId()); testResourcePoolService.getTestResourcePool(resourcePool.getId());
commonProjectService.validateProjectResourcePool(resourcePool, DEFAULT_PROJECT_ID); commonProjectService.validateProjectResourcePool(resourcePool, DEFAULT_PROJECT_ID);
testResourcePoolService.validateOrgResourcePool(resourcePool, DEFAULT_ORGANIZATION_ID); testResourcePoolService.validateOrgResourcePool(resourcePool, DEFAULT_ORGANIZATION_ID);

View File

@ -653,7 +653,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
@Override @Override
public void initResourceDefaultCollection(String planId, List<TestPlanCollectionDTO> defaultCollections) { public void initResourceDefaultCollection(String planId, List<TestPlanCollectionDTO> defaultCollections) {
TestPlanCollectionDTO defaultCollection = defaultCollections.stream().filter(collection -> StringUtils.equals(collection.getType(), CaseType.API_CASE.getKey()) TestPlanCollectionDTO defaultCollection = defaultCollections.stream().filter(collection -> StringUtils.equals(collection.getType(), CaseType.API_CASE.getKey())
&& !StringUtils.equals(collection.getParentId(), "NONE")).toList().get(0); && !StringUtils.equals(collection.getParentId(), "NONE")).toList().getFirst();
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestPlanApiCaseMapper apiBatchMapper = sqlSession.getMapper(TestPlanApiCaseMapper.class); TestPlanApiCaseMapper apiBatchMapper = sqlSession.getMapper(TestPlanApiCaseMapper.class);
TestPlanApiCase record = new TestPlanApiCase(); TestPlanApiCase record = new TestPlanApiCase();

View File

@ -243,7 +243,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
@Override @Override
public void initResourceDefaultCollection(String planId, List<TestPlanCollectionDTO> defaultCollections) { public void initResourceDefaultCollection(String planId, List<TestPlanCollectionDTO> defaultCollections) {
TestPlanCollectionDTO defaultCollection = defaultCollections.stream().filter(collection -> StringUtils.equals(collection.getType(), CaseType.SCENARIO_CASE.getKey()) TestPlanCollectionDTO defaultCollection = defaultCollections.stream().filter(collection -> StringUtils.equals(collection.getType(), CaseType.SCENARIO_CASE.getKey())
&& !StringUtils.equals(collection.getParentId(), "NONE")).toList().get(0); && !StringUtils.equals(collection.getParentId(), "NONE")).toList().getFirst();
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestPlanApiScenarioMapper scenarioBatchMapper = sqlSession.getMapper(TestPlanApiScenarioMapper.class); TestPlanApiScenarioMapper scenarioBatchMapper = sqlSession.getMapper(TestPlanApiScenarioMapper.class);
TestPlanApiScenario record = new TestPlanApiScenario(); TestPlanApiScenario record = new TestPlanApiScenario();

View File

@ -351,7 +351,7 @@ public class TestPlanCollectionMinderService {
@NotNull @NotNull
private static TestPlanCollection updateCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) { private static TestPlanCollection updateCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
TestPlanCollection testPlanCollection = new TestPlanCollection(); TestPlanCollection testPlanCollection = new TestPlanCollection();
TestPlanCollection parent = parentMap.get(testPlanCollectionMinderEditDTO.getType()).get(0); TestPlanCollection parent = parentMap.get(testPlanCollectionMinderEditDTO.getType()).getFirst();
if (testPlanCollectionMinderEditDTO.getExtended()) { if (testPlanCollectionMinderEditDTO.getExtended()) {
BeanUtils.copyBean(testPlanCollection, parent); BeanUtils.copyBean(testPlanCollection, parent);
} else { } else {
@ -379,7 +379,7 @@ public class TestPlanCollectionMinderService {
@NotNull @NotNull
private static TestPlanCollection addCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) { private static TestPlanCollection addCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
List<TestPlanCollection> testPlanCollections = parentMap.get(testPlanCollectionMinderEditDTO.getType()); List<TestPlanCollection> testPlanCollections = parentMap.get(testPlanCollectionMinderEditDTO.getType());
TestPlanCollection parent = testPlanCollections.get(0); TestPlanCollection parent = testPlanCollections.getFirst();
TestPlanCollection testPlanCollection = new TestPlanCollection(); TestPlanCollection testPlanCollection = new TestPlanCollection();
if (testPlanCollectionMinderEditDTO.getExtended()) { if (testPlanCollectionMinderEditDTO.getExtended()) {
BeanUtils.copyBean(testPlanCollection, parent); BeanUtils.copyBean(testPlanCollection, parent);

View File

@ -259,7 +259,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
Map<String, List<FunctionalCaseCustomFieldDTO>> collect = functionalCaseService.getCaseCustomFiledMap(ids, projectId); Map<String, List<FunctionalCaseCustomFieldDTO>> collect = functionalCaseService.getCaseCustomFiledMap(ids, projectId);
Set<String> userIds = extractUserIds(functionalCaseLists); Set<String> userIds = extractUserIds(functionalCaseLists);
List<String> relateIds = functionalCaseLists.stream().map(TestPlanCasePageResponse::getId).collect(Collectors.toList()); List<String> relateIds = functionalCaseLists.stream().map(TestPlanCasePageResponse::getId).collect(Collectors.toList());
Map<String, List<CaseRelateBugDTO>> bugListMap = getBugData(relateIds, functionalCaseLists.get(0).getTestPlanId()); Map<String, List<CaseRelateBugDTO>> bugListMap = getBugData(relateIds, functionalCaseLists.getFirst().getTestPlanId());
List<SelectOption> statusOption = bugStatusService.getHeaderStatusOption(projectId); List<SelectOption> statusOption = bugStatusService.getHeaderStatusOption(projectId);
Map<String, String> statusMap = statusOption.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText)); Map<String, String> statusMap = statusOption.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
Map<String, String> userMap = userLoginService.getUserNameMap(new ArrayList<>(userIds)); Map<String, String> userMap = userLoginService.getUserNameMap(new ArrayList<>(userIds));
@ -708,7 +708,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
List<TestPlanCaseExecuteHistory> testPlanCaseExecuteHistories = extTestPlanCaseExecuteHistoryMapper.selectSteps(id, caseId); List<TestPlanCaseExecuteHistory> testPlanCaseExecuteHistories = extTestPlanCaseExecuteHistoryMapper.selectSteps(id, caseId);
List<FunctionalCaseStepDTO> functionalCaseStepDTOS = new ArrayList<>(); List<FunctionalCaseStepDTO> functionalCaseStepDTOS = new ArrayList<>();
if (CollectionUtils.isNotEmpty(testPlanCaseExecuteHistories)) { if (CollectionUtils.isNotEmpty(testPlanCaseExecuteHistories)) {
TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = testPlanCaseExecuteHistories.get(0); TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = testPlanCaseExecuteHistories.getFirst();
if (StringUtils.isNotBlank(caseDetailSteps)) { if (StringUtils.isNotBlank(caseDetailSteps)) {
List<FunctionalCaseStepDTO> newCaseSteps = JSON.parseArray(caseDetailSteps, FunctionalCaseStepDTO.class); List<FunctionalCaseStepDTO> newCaseSteps = JSON.parseArray(caseDetailSteps, FunctionalCaseStepDTO.class);
compareStep(testPlanCaseExecuteHistory, newCaseSteps); compareStep(testPlanCaseExecuteHistory, newCaseSteps);
@ -900,7 +900,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
@Override @Override
public void initResourceDefaultCollection(String planId, List<TestPlanCollectionDTO> defaultCollections) { public void initResourceDefaultCollection(String planId, List<TestPlanCollectionDTO> defaultCollections) {
TestPlanCollectionDTO defaultCollection = defaultCollections.stream().filter(collection -> StringUtils.equals(collection.getType(), CaseType.FUNCTIONAL_CASE.getKey()) TestPlanCollectionDTO defaultCollection = defaultCollections.stream().filter(collection -> StringUtils.equals(collection.getType(), CaseType.FUNCTIONAL_CASE.getKey())
&& !StringUtils.equals(collection.getParentId(), "NONE")).toList().get(0); && !StringUtils.equals(collection.getParentId(), "NONE")).toList().getFirst();
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestPlanFunctionalCaseMapper functionalBatchMapper = sqlSession.getMapper(TestPlanFunctionalCaseMapper.class); TestPlanFunctionalCaseMapper functionalBatchMapper = sqlSession.getMapper(TestPlanFunctionalCaseMapper.class);
TestPlanFunctionalCase record = new TestPlanFunctionalCase(); TestPlanFunctionalCase record = new TestPlanFunctionalCase();

View File

@ -188,7 +188,7 @@ public class TestPlanLogService {
if (CollectionUtils.isEmpty(plans)) { if (CollectionUtils.isEmpty(plans)) {
return; return;
} }
Project project = projectMapper.selectByPrimaryKey(plans.get(0).getProjectId()); Project project = projectMapper.selectByPrimaryKey(plans.getFirst().getProjectId());
List<LogDTO> list = new ArrayList<>(); List<LogDTO> list = new ArrayList<>();
for (TestPlan plan : plans) { for (TestPlan plan : plans) {
LogDTO dto = LogDTOBuilder.builder() LogDTO dto = LogDTOBuilder.builder()

View File

@ -24,7 +24,7 @@ public class CountUtils {
return new CaseCount(); return new CaseCount();
} }
Class<CaseCount> clazz = (Class<CaseCount>) list.get(0).getClass(); Class<CaseCount> clazz = (Class<CaseCount>) list.getFirst().getClass();
CaseCount summary; CaseCount summary;
try { try {
summary = clazz.newInstance(); summary = clazz.newInstance();

Some files were not shown because too many files have changed in this diff Show More