mirror of https://gitee.com/stylefeng/roses
【8.3.0】【scanner】【test】更新基础信息的测试
parent
44ddcd16ea
commit
c0c09689f4
|
@ -0,0 +1,78 @@
|
||||||
|
package cn.stylefeng.roses.kernel.scanner.api;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
|
import cn.hutool.core.lang.TypeReference;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.stylefeng.roses.kernel.scanner.api.factory.ClassMetaFactory;
|
||||||
|
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.FieldMetadata;
|
||||||
|
import cn.stylefeng.roses.kernel.scanner.api.util.AdvancedClassTypeUtil;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONWriter;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2024/8/7 14:25
|
||||||
|
*/
|
||||||
|
public class TestBase {
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void setUp() {
|
||||||
|
AdvancedClassTypeUtil.TEMP_SCAN_PACKAGE_LIST = ListUtil.of("cn.stylefeng");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testString() {
|
||||||
|
Type type = new TypeReference<String>() {
|
||||||
|
}.getType();
|
||||||
|
|
||||||
|
FieldMetadata fieldMetadata = ClassMetaFactory.beginCreateFieldMetadata(type, IdUtil.fastSimpleUUID());
|
||||||
|
|
||||||
|
String jsonString = JSON.toJSONString(fieldMetadata, JSONWriter.Feature.PrettyFormat);
|
||||||
|
|
||||||
|
System.out.println(jsonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInteger() {
|
||||||
|
Type type = new TypeReference<Integer>() {
|
||||||
|
}.getType();
|
||||||
|
|
||||||
|
FieldMetadata fieldMetadata = ClassMetaFactory.beginCreateFieldMetadata(type, IdUtil.fastSimpleUUID());
|
||||||
|
|
||||||
|
String jsonString = JSON.toJSONString(fieldMetadata, JSONWriter.Feature.PrettyFormat);
|
||||||
|
|
||||||
|
System.out.println(jsonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFloat() {
|
||||||
|
Type type = new TypeReference<Float>() {
|
||||||
|
}.getType();
|
||||||
|
|
||||||
|
FieldMetadata fieldMetadata = ClassMetaFactory.beginCreateFieldMetadata(type, IdUtil.fastSimpleUUID());
|
||||||
|
|
||||||
|
String jsonString = JSON.toJSONString(fieldMetadata, JSONWriter.Feature.PrettyFormat);
|
||||||
|
|
||||||
|
System.out.println(jsonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBigdecimal() {
|
||||||
|
Type type = new TypeReference<BigDecimal>() {
|
||||||
|
}.getType();
|
||||||
|
|
||||||
|
FieldMetadata fieldMetadata = ClassMetaFactory.beginCreateFieldMetadata(type, IdUtil.fastSimpleUUID());
|
||||||
|
|
||||||
|
String jsonString = JSON.toJSONString(fieldMetadata, JSONWriter.Feature.PrettyFormat);
|
||||||
|
|
||||||
|
System.out.println(jsonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue