refactor(项目设置): 优化状态流单元测试代码
This commit is contained in:
parent
f494bcf001
commit
e90a9bac8a
|
@ -29,7 +29,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static io.metersphere.project.enums.result.ProjectResultCode.PROJECT_TEMPLATE_PERMISSION;
|
import static io.metersphere.project.enums.result.ProjectResultCode.PROJECT_TEMPLATE_PERMISSION;
|
||||||
import static io.metersphere.system.controller.handler.result.CommonResultCode.STATUS_ITEM_EXIST;
|
import static io.metersphere.system.controller.handler.result.CommonResultCode.STATUS_ITEM_EXIST;
|
||||||
|
@ -302,7 +304,8 @@ public class ProjectStatusFlowSettingControllerTest extends BaseTest {
|
||||||
@Order(6)
|
@Order(6)
|
||||||
public void sortStatusItem() throws Exception {
|
public void sortStatusItem() throws Exception {
|
||||||
List<StatusItem> statusItems = baseStatusItemService.getByScopeIdAndScene(DEFAULT_PROJECT_ID, TemplateScene.BUG.name());
|
List<StatusItem> statusItems = baseStatusItemService.getByScopeIdAndScene(DEFAULT_PROJECT_ID, TemplateScene.BUG.name());
|
||||||
List<String> statusIds = statusItems.stream().map(StatusItem::getId).toList().reversed();
|
List<String> statusIds = statusItems.stream().map(StatusItem::getId).collect(Collectors.toList());
|
||||||
|
Collections.reverse(statusIds);
|
||||||
// @@校验请求成功
|
// @@校验请求成功
|
||||||
this.requestPostWithOkAndReturn(STATUS_SORT, statusIds, DEFAULT_PROJECT_ID, TemplateScene.BUG.name());
|
this.requestPostWithOkAndReturn(STATUS_SORT, statusIds, DEFAULT_PROJECT_ID, TemplateScene.BUG.name());
|
||||||
OrganizationStatusFlowSettingControllerTest.assertSortStatusItem(DEFAULT_PROJECT_ID, statusIds);
|
OrganizationStatusFlowSettingControllerTest.assertSortStatusItem(DEFAULT_PROJECT_ID, statusIds);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -393,7 +394,8 @@ public class OrganizationStatusFlowSettingControllerTest extends BaseTest {
|
||||||
@Order(6)
|
@Order(6)
|
||||||
public void sortStatusItem() throws Exception {
|
public void sortStatusItem() throws Exception {
|
||||||
List<StatusItem> statusItems = baseStatusItemService.getByScopeIdAndScene(DEFAULT_ORGANIZATION_ID, TemplateScene.BUG.name());
|
List<StatusItem> statusItems = baseStatusItemService.getByScopeIdAndScene(DEFAULT_ORGANIZATION_ID, TemplateScene.BUG.name());
|
||||||
List<String> statusIds = statusItems.stream().map(StatusItem::getId).toList().reversed();
|
List<String> statusIds = statusItems.stream().map(StatusItem::getId).collect(Collectors.toList());
|
||||||
|
Collections.reverse(statusIds);
|
||||||
// @@校验请求成功
|
// @@校验请求成功
|
||||||
this.requestPostWithOkAndReturn(STATUS_SORT, statusIds, DEFAULT_ORGANIZATION_ID, TemplateScene.BUG.name());
|
this.requestPostWithOkAndReturn(STATUS_SORT, statusIds, DEFAULT_ORGANIZATION_ID, TemplateScene.BUG.name());
|
||||||
assertSortStatusItem(DEFAULT_ORGANIZATION_ID, statusIds);
|
assertSortStatusItem(DEFAULT_ORGANIZATION_ID, statusIds);
|
||||||
|
|
Loading…
Reference in New Issue