mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
产品延期管理单元测试完善
This commit is contained in:
+9
-1
@@ -12,6 +12,7 @@ import uk.co.jemos.podam.api.PodamFactoryImpl;
|
||||
import uk.co.jemos.podam.api.RandomDataProviderStrategy;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@@ -50,7 +51,7 @@ public class RandomUtils {
|
||||
}
|
||||
// 如果是 type、status 结尾的字段,返回 tinyint 范围
|
||||
if (CharSequenceUtil.endWithAnyIgnoreCase(attributeMetadata.getAttributeName(),
|
||||
"type", "status", "category", "scope", "result", "sort")) {
|
||||
"type", "status", "category", "scope", "result", "sort", "unit")) {
|
||||
return RandomUtil.randomInt(0, TINYINT_MAX + 1);
|
||||
}
|
||||
return RandomUtil.randomInt();
|
||||
@@ -66,6 +67,9 @@ public class RandomUtils {
|
||||
}
|
||||
return RandomUtil.randomBoolean();
|
||||
});
|
||||
// BigDecimal
|
||||
PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(BigDecimal.class,
|
||||
(dataProviderStrategy, attributeMetadata, map) -> randomBigDecimal());
|
||||
((RandomDataProviderStrategy) PODAM_FACTORY.getStrategy()).addOrReplaceAttributeStrategy(NumberValid.class, new NumberValidStrategy());
|
||||
}
|
||||
|
||||
@@ -81,6 +85,10 @@ public class RandomUtils {
|
||||
return RandomUtil.randomInt(0, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static BigDecimal randomBigDecimal() {
|
||||
return RandomUtil.randomBigDecimal(BigDecimal.ZERO, BigDecimal.TEN);
|
||||
}
|
||||
|
||||
public static Date randomDate() {
|
||||
return RandomUtil.randomDay(0, RANDOM_DATE_MAX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user