mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
add test
This commit is contained in:
@@ -156,6 +156,16 @@ public class BeanUtilTest {
|
||||
Assert.assertEquals("sub名字", map.get("aliasSubName"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mapToBeanWithAliasTest() {
|
||||
Map<String, Object> map = MapUtil.newHashMap();
|
||||
map.put("aliasSubName", "sub名字");
|
||||
map.put("slow", true);
|
||||
|
||||
final SubPersonWithAlias subPersonWithAlias = BeanUtil.mapToBean(map, SubPersonWithAlias.class, false);
|
||||
Assert.assertEquals("sub名字", subPersonWithAlias.getSubName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beanToMapWithLocalDateTimeTest() {
|
||||
final LocalDateTime now = LocalDateTime.now();
|
||||
|
@@ -0,0 +1,16 @@
|
||||
package cn.hutool.core.comparator;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CompareUtilTest {
|
||||
|
||||
@Test
|
||||
public void compareTest(){
|
||||
int compare = CompareUtil.compare(null, "a", true);
|
||||
Assert.assertTrue(compare > 0);
|
||||
|
||||
compare = CompareUtil.compare(null, "a", false);
|
||||
Assert.assertTrue(compare < 0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user