diff --git a/platform-flow-gateway/src/test/java/com/eip4/platform/flowgateway/FlowableClientTest.java b/platform-flow-gateway/src/test/java/com/eip4/platform/flowgateway/FlowableClientTest.java index d0284f2..6e88feb 100644 --- a/platform-flow-gateway/src/test/java/com/eip4/platform/flowgateway/FlowableClientTest.java +++ b/platform-flow-gateway/src/test/java/com/eip4/platform/flowgateway/FlowableClientTest.java @@ -2,6 +2,8 @@ package com.eip4.platform.flowgateway; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.springframework.test.web.client.match.MockRestRequestMatchers.jsonPath; +import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus; import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; @@ -10,6 +12,7 @@ import java.util.List; import java.util.Map; import org.junit.jupiter.api.Test; +import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.test.web.client.ExpectedCount; @@ -77,7 +80,9 @@ class FlowableClientTest { MockRestServiceServer server = MockRestServiceServer.bindTo(builder).build(); String body = "[{\"id\":\"T1\",\"name\":\"接收交底(项目部)\",\"assignee\":\"U1\"," + "\"businessKey\":\"BK-1\",\"processInstanceId\":\"P1\",\"suspended\":false}]"; - server.expect(requestTo(("http://localhost:8089/api/flow/tasks/todo?assignee=U1&firstResult=0&maxResults=50"))) + // F2-6 JWT 瘦身:待办改 POST body(candidateGroups 入 body,避免多角色 URL 超 8KB) + server.expect(requestTo("http://localhost:8089/api/flow/tasks/todo")) + .andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(body, MediaType.APPLICATION_JSON)); FlowableClient client = new FlowableClient(builder.build(), p); @@ -94,8 +99,11 @@ class FlowableClientTest { FlowGatewayProperties p = props(); RestClient.Builder builder = RestClient.builder().baseUrl(p.getBaseUrl()); MockRestServiceServer server = MockRestServiceServer.bindTo(builder).build(); - server.expect(requestTo( - "http://localhost:8089/api/flow/tasks/todo?assignee=U1&candidateGroup=R1&candidateGroup=R2&firstResult=0&maxResults=50")) + // F2-6:候选组多值经 POST body 的 candidateGroups 数组下发(不再逐个 query 参数) + server.expect(requestTo("http://localhost:8089/api/flow/tasks/todo")) + .andExpect(method(HttpMethod.POST)) + .andExpect(jsonPath("$.candidateGroups[0]").value("R1")) + .andExpect(jsonPath("$.candidateGroups[1]").value("R2")) .andRespond(withSuccess("[]", MediaType.APPLICATION_JSON)); FlowableClient client = new FlowableClient(builder.build(), p);