Commit 50517cfc1340702a717d4f9333d902289df9cfd4
1 parent
725940ad
feat(mes):优化 JDK8 的兼容性
Showing
1 changed file
with
5 additions
and
0 deletions
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java
| @@ -9,6 +9,7 @@ import uk.co.jemos.podam.api.PodamFactory; | @@ -9,6 +9,7 @@ import uk.co.jemos.podam.api.PodamFactory; | ||
| 9 | import uk.co.jemos.podam.api.PodamFactoryImpl; | 9 | import uk.co.jemos.podam.api.PodamFactoryImpl; |
| 10 | 10 | ||
| 11 | import java.lang.reflect.Type; | 11 | import java.lang.reflect.Type; |
| 12 | +import java.math.BigDecimal; | ||
| 12 | import java.time.LocalDateTime; | 13 | import java.time.LocalDateTime; |
| 13 | import java.util.Arrays; | 14 | import java.util.Arrays; |
| 14 | import java.util.Date; | 15 | import java.util.Date; |
| @@ -52,6 +53,10 @@ public class RandomUtils { | @@ -52,6 +53,10 @@ public class RandomUtils { | ||
| 52 | } | 53 | } |
| 53 | return RandomUtil.randomInt(); | 54 | return RandomUtil.randomInt(); |
| 54 | }); | 55 | }); |
| 56 | + // BigDecimal:限制精度在 DECIMAL(10,2) 范围内,避免 H2 等数据库溢出 | ||
| 57 | + PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(BigDecimal.class, | ||
| 58 | + (dataProviderStrategy, attributeMetadata, map) -> | ||
| 59 | + BigDecimal.valueOf(RandomUtil.randomInt(0, 10000000), 2)); | ||
| 55 | // LocalDateTime | 60 | // LocalDateTime |
| 56 | PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(LocalDateTime.class, | 61 | PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(LocalDateTime.class, |
| 57 | (dataProviderStrategy, attributeMetadata, map) -> randomLocalDateTime()); | 62 | (dataProviderStrategy, attributeMetadata, map) -> randomLocalDateTime()); |