This is an automated email from the ASF dual-hosted git repository.

xcsnx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 449832413d fix:AiResponseTransformerPluginTest run error (#6169)
449832413d is described below

commit 449832413d153159f04763c25088d3a41b5ee653
Author: Wweiei <[email protected]>
AuthorDate: Mon Sep 22 14:49:30 2025 +0800

    fix:AiResponseTransformerPluginTest run error (#6169)
    
    Co-authored-by: aias00 <[email protected]>
    Co-authored-by: xcsnx <[email protected]>
---
 .../ai/transformer/response/AiResponseTransformerPluginTest.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-response-transformer/src/test/java/org/apache/shenyu/plugin/ai/transformer/response/AiResponseTransformerPluginTest.java
 
b/shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-response-transformer/src/test/java/org/apache/shenyu/plugin/ai/transformer/response/AiResponseTransformerPluginTest.java
index 3443c5450a..80ad9b0bb2 100644
--- 
a/shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-response-transformer/src/test/java/org/apache/shenyu/plugin/ai/transformer/response/AiResponseTransformerPluginTest.java
+++ 
b/shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-response-transformer/src/test/java/org/apache/shenyu/plugin/ai/transformer/response/AiResponseTransformerPluginTest.java
@@ -42,6 +42,7 @@ import java.util.Collections;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import static org.mockito.Mockito.lenient;
@@ -99,7 +100,12 @@ class AiResponseTransformerPluginTest {
         
         // Configure chain mock
         when(chain.execute(exchange)).thenReturn(Mono.empty());
-        
+
+        // Mock the mutate() method to return a builder
+        ServerWebExchange.Builder builder = 
mock(ServerWebExchange.Builder.class);
+        when(exchange.mutate()).thenReturn(builder);
+        when(builder.response(any())).thenReturn(builder);
+        when(builder.build()).thenReturn(exchange);
         // Execute plugin
         Mono<Void> result = plugin.doExecute(exchange, chain, selectorData, 
ruleData);
         

Reply via email to