mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
Date convert throw expt
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cn.hutool.core.convert;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateException;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -11,6 +12,7 @@ import org.junit.Test;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicIntegerArray;
|
||||
@@ -245,7 +247,7 @@ public class ConvertTest {
|
||||
@Test
|
||||
public void toClassTest(){
|
||||
final Class<?> convert = Convert.convert(Class.class, "cn.hutool.core.convert.ConvertTest.Product");
|
||||
Assert.assertEquals(Product.class, convert);
|
||||
Assert.assertSame(Product.class, convert);
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -288,4 +290,10 @@ public class ConvertTest {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = DateException.class)
|
||||
public void toDateTest(){
|
||||
// 默认转换失败报错而不是返回null
|
||||
Convert.convert(Date.class, "aaaa");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user