Ver código fonte

fix(test): 修复 ProductControllerTest 与 OrchestrationEngineTest 的签名漂移

iwt 2 dias atrás
pai
commit
8ac8a4c3ac

+ 8 - 8
cfc-backend/src/test/java/com/etotem/cfc/integration/controller/ProductControllerTest.java

@@ -49,10 +49,10 @@ public class ProductControllerTest {
         mockResult.put("page", 1);
         mockResult.put("size", 10);
 
-        when(productService.list(any(ProductListQueryDTO.class), isNull()))
+        when(productService.list(any(ProductListQueryDTO.class), isNull(), any()))
                 .thenReturn(Result.success(mockResult));
 
-        Result<Map<String, Object>> result = controller.list(query, null);
+        Result<Map<String, Object>> result = controller.list(query, null, "admin");
 
         assertEquals(200, result.getCode());
         assertNotNull(result.getData());
@@ -76,10 +76,10 @@ public class ProductControllerTest {
         mockResult.put("page", 1);
         mockResult.put("size", 10);
 
-        when(productService.list(any(ProductListQueryDTO.class), isNull()))
+        when(productService.list(any(ProductListQueryDTO.class), isNull(), any()))
                 .thenReturn(Result.success(mockResult));
 
-        Result<Map<String, Object>> result = controller.list(query, null);
+        Result<Map<String, Object>> result = controller.list(query, null, "admin");
 
         assertEquals(200, result.getCode());
         @SuppressWarnings("unchecked")
@@ -100,10 +100,10 @@ public class ProductControllerTest {
         ));
         mockResult.put("total", 1L);
 
-        when(productService.list(any(ProductListQueryDTO.class), isNull()))
+        when(productService.list(any(ProductListQueryDTO.class), isNull(), any()))
                 .thenReturn(Result.success(mockResult));
 
-        Result<Map<String, Object>> result = controller.list(query, null);
+        Result<Map<String, Object>> result = controller.list(query, null, "admin");
 
         assertEquals(200, result.getCode());
         @SuppressWarnings("unchecked")
@@ -122,10 +122,10 @@ public class ProductControllerTest {
         mockResult.put("records", Collections.emptyList());
         mockResult.put("total", 0L);
 
-        when(productService.list(any(ProductListQueryDTO.class), isNull()))
+        when(productService.list(any(ProductListQueryDTO.class), isNull(), any()))
                 .thenReturn(Result.success(mockResult));
 
-        Result<Map<String, Object>> result = controller.list(query, null);
+        Result<Map<String, Object>> result = controller.list(query, null, "admin");
 
         assertEquals(200, result.getCode());
         @SuppressWarnings("unchecked")

+ 2 - 4
cfc-backend/src/test/java/com/etotem/cfc/orchestration/OrchestrationEngineTest.java

@@ -145,9 +145,8 @@ class OrchestrationEngineTest {
         when(nodeInstanceMapper.selectOne(any())).thenReturn(ni);
         when(executionMapper.selectById(execId)).thenReturn(makeExec(execId, 1L));
 
-        boolean result = engine.onTaskCompleted(taskId);
+        engine.onTaskCompleted(taskId);
 
-        assertThat(result).isTrue();
         ArgumentCaptor<TaskOrchestrationNodeInstance> captor =
                 ArgumentCaptor.forClass(TaskOrchestrationNodeInstance.class);
         verify(nodeInstanceMapper).updateById(captor.capture());
@@ -167,9 +166,8 @@ class OrchestrationEngineTest {
         when(nodeInstanceMapper.selectOne(any())).thenReturn(ni);
         when(executionMapper.selectById(execId)).thenReturn(makeExec(execId, 2L));
 
-        boolean result = engine.onTaskFailed(taskId);
+        engine.onTaskFailed(taskId);
 
-        assertThat(result).isTrue();
         ArgumentCaptor<TaskOrchestrationNodeInstance> captor =
                 ArgumentCaptor.forClass(TaskOrchestrationNodeInstance.class);
         verify(nodeInstanceMapper).updateById(captor.capture());