瀏覽代碼

fix(train): CfcSyncIdempotencyTest List.of()→Collections.singletonList() 兼容 Java 8 编译

Java 8 target 不支持 java.util.List.of();替换为 Collections.singletonList(pending)
以解除测试编译失败阻塞,使 TrainPromoRuleconfigContractTest 可正常运行于 RED 验证。
liaoxg 3 天之前
父節點
當前提交
6b55af8fea
共有 1 個文件被更改,包括 2 次插入 和 1 次删除
  1. 2 1
      train-backend/src/test/java/com/train/service/impl/CfcSyncIdempotencyTest.java

+ 2 - 1
train-backend/src/test/java/com/train/service/impl/CfcSyncIdempotencyTest.java

@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.ArgumentCaptor;
 import org.springframework.test.util.ReflectionTestUtils;
 import org.springframework.test.util.ReflectionTestUtils;
 
 
+import java.util.Collections;
 import java.util.List;
 import java.util.List;
 
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -128,7 +129,7 @@ class CfcSyncIdempotencyTest {
         pending.setSourceType(SOURCE_TYPE);
         pending.setSourceType(SOURCE_TYPE);
         pending.setSourceId(SOURCE_ID);
         pending.setSourceId(SOURCE_ID);
         pending.setHours(HOURS);
         pending.setHours(HOURS);
-        when(logMapper.selectList(any())).thenReturn(List.of(pending));
+        when(logMapper.selectList(any())).thenReturn(Collections.singletonList(pending));
         when(logMapper.selectOne(any())).thenReturn(pending); // 日志已存在 → 走更新分支而非 insert
         when(logMapper.selectOne(any())).thenReturn(pending); // 日志已存在 → 走更新分支而非 insert
 
 
         int ok = service.retryPending();
         int ok = service.retryPending();