Commit ca702b81afdc1ad847378b9806bb00548464a017

Authored by YunaiV
1 parent f1660e18

fix: 优化对 JDK8 的兼容性

yudao-module-bpm/src/test/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/BpmTaskCandidateInvokerTest.java
1 1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate;
2 2  
  3 +import cn.hutool.core.collection.ListUtil;
3 4 import cn.hutool.core.map.MapUtil;
4 5 import cn.hutool.extra.spring.SpringUtil;
5 6 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
... ... @@ -64,7 +65,7 @@ public class BpmTaskCandidateInvokerTest extends BaseMockitoUnitTest {
64 65 public void setUp() {
65 66 userStrategy = new BpmTaskCandidateUserStrategy(); // 创建 strategy 实例
66 67 when(emptyStrategy.getStrategy()).thenReturn(BpmTaskCandidateStrategyEnum.ASSIGN_EMPTY);
67   - strategyList = List.of(userStrategy, emptyStrategy); // 创建 strategyList
  68 + strategyList = ListUtil.of(userStrategy, emptyStrategy); // 创建 strategyList
68 69 taskCandidateInvoker = new BpmTaskCandidateInvoker(strategyList, adminUserApi);
69 70 }
70 71  
... ...
yudao-module-bpm/src/test/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/dept/BpmTaskCandidateStartUserSelectStrategyTest.java
1 1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept;
2 2  
  3 +import cn.hutool.core.collection.ListUtil;
3 4 import cn.hutool.core.map.MapUtil;
4 5 import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
5 6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants;
... ... @@ -12,7 +13,6 @@ import org.mockito.InjectMocks;
12 13 import org.mockito.Mock;
13 14  
14 15 import java.util.HashMap;
15   -import java.util.List;
16 16 import java.util.Map;
17 17 import java.util.Set;
18 18  
... ... @@ -41,7 +41,7 @@ public class BpmTaskCandidateStartUserSelectStrategyTest extends BaseMockitoUnit
41 41 // mock 方法(FlowableUtils)
42 42 Map<String, Object> processVariables = new HashMap<>();
43 43 processVariables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES,
44   - MapUtil.of("activity_001", List.of(1L, 2L)));
  44 + MapUtil.of("activity_001", ListUtil.of(1L, 2L)));
45 45 when(processInstance.getProcessVariables()).thenReturn(processVariables);
46 46  
47 47 // 调用
... ... @@ -56,7 +56,7 @@ public class BpmTaskCandidateStartUserSelectStrategyTest extends BaseMockitoUnit
56 56 String activityId = "activity_001";
57 57 Map<String, Object> processVariables = new HashMap<>();
58 58 processVariables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES,
59   - MapUtil.of("activity_001", List.of(1L, 2L)));
  59 + MapUtil.of("activity_001", ListUtil.of(1L, 2L)));
60 60  
61 61 // 调用
62 62 Set<Long> userIds = strategy.calculateUsersByActivity(null, activityId, null,
... ...
yudao-module-mall/yudao-module-trade/src/test/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordServiceImplTest.java
... ... @@ -22,7 +22,6 @@ import org.springframework.context.annotation.Import;
22 22 import org.springframework.test.context.bean.override.mockito.MockitoBean;
23 23  
24 24 import java.math.RoundingMode;
25   -import java.util.List;
26 25  
27 26 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
28 27 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
... ... @@ -162,7 +161,7 @@ public class BrokerageRecordServiceImplTest extends BaseDbUnitTest {
162 161  
163 162 ProductSkuRespDTO sku = new ProductSkuRespDTO();
164 163 sku.setPrice(1000);
165   - when(productSkuApi.getSkuListBySpuId(ListUtil.of(1L))).thenReturn(List.of(sku));
  164 + when(productSkuApi.getSkuListBySpuId(ListUtil.of(1L))).thenReturn(ListUtil.of(sku));
166 165  
167 166 // 调用
168 167 AppBrokerageProductPriceRespVO result = brokerageRecordService.calculateProductBrokeragePrice(100L, 1L);
... ... @@ -190,7 +189,7 @@ public class BrokerageRecordServiceImplTest extends BaseDbUnitTest {
190 189 ProductSkuRespDTO sku = new ProductSkuRespDTO();
191 190 sku.setPrice(1000);
192 191 sku.setFirstBrokeragePrice(0);
193   - when(productSkuApi.getSkuListBySpuId(ListUtil.of(2L))).thenReturn(List.of(sku));
  192 + when(productSkuApi.getSkuListBySpuId(ListUtil.of(2L))).thenReturn(ListUtil.of(sku));
194 193  
195 194 // 调用
196 195 AppBrokerageProductPriceRespVO result = brokerageRecordService.calculateProductBrokeragePrice(100L, 2L);
... ... @@ -221,7 +220,7 @@ public class BrokerageRecordServiceImplTest extends BaseDbUnitTest {
221 220 ProductSkuRespDTO fixedBrokerageSku = new ProductSkuRespDTO();
222 221 fixedBrokerageSku.setPrice(2000);
223 222 fixedBrokerageSku.setFirstBrokeragePrice(200);
224   - when(productSkuApi.getSkuListBySpuId(ListUtil.of(3L))).thenReturn(List.of(nullBrokerageSku, fixedBrokerageSku));
  223 + when(productSkuApi.getSkuListBySpuId(ListUtil.of(3L))).thenReturn(ListUtil.of(nullBrokerageSku, fixedBrokerageSku));
225 224  
226 225 // 调用
227 226 AppBrokerageProductPriceRespVO result = brokerageRecordService.calculateProductBrokeragePrice(100L, 3L);
... ... @@ -245,7 +244,7 @@ public class BrokerageRecordServiceImplTest extends BaseDbUnitTest {
245 244 ProductSpuRespDTO spu = new ProductSpuRespDTO();
246 245 spu.setSubCommissionType(true);
247 246 when(productSpuApi.getSpu(4L)).thenReturn(spu);
248   - when(productSkuApi.getSkuListBySpuId(ListUtil.of(4L))).thenReturn(List.of());
  247 + when(productSkuApi.getSkuListBySpuId(ListUtil.of(4L))).thenReturn(ListUtil.of());
249 248  
250 249 // 调用
251 250 AppBrokerageProductPriceRespVO result = brokerageRecordService.calculateProductBrokeragePrice(100L, 4L);
... ...