fix TypeReference not fit Type

This commit is contained in:
Looly
2019-08-16 22:19:03 +08:00
parent a91686a7e1
commit e42c0216db
6 changed files with 99 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import org.junit.Assert;
import org.junit.Test;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Console;
/**
* 类型转换工具单元测试
@@ -26,13 +27,15 @@ public class ConvertTest {
public void toStrTest() {
int a = 1;
long[] b = { 1, 2, 3, 4, 5 };
Console.log(Convert.convert(String.class, b));
String aStr = Convert.toStr(a);
Assert.assertEquals("1", aStr);
String bStr = Convert.toStr(b);
Assert.assertEquals("[1, 2, 3, 4, 5]", Convert.toStr(bStr));
}
@Test
public void toStrTest2() {
String result = Convert.convert(String.class, "aaaa");