mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add test
This commit is contained in:
@@ -2,6 +2,7 @@ package cn.hutool.core.util;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Console;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@@ -70,6 +71,17 @@ public class IdcardUtilTest {
|
|||||||
Assert.assertEquals(age2, 28);
|
Assert.assertEquals(age2, 28);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAgeByIdCardTest2() {
|
||||||
|
DateTime date = DateUtil.parse("2014-07-11");
|
||||||
|
int age = IdcardUtil.getAgeByIdCard("321083200807112119", date);
|
||||||
|
Console.log(age);
|
||||||
|
|
||||||
|
date = DateUtil.parse("2014-07-31");
|
||||||
|
age = IdcardUtil.getAgeByIdCard("321083200807312119", date);
|
||||||
|
Console.log(age);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getBirthByIdCardTest() {
|
public void getBirthByIdCardTest() {
|
||||||
String birth = IdcardUtil.getBirthByIdCard(ID_18);
|
String birth = IdcardUtil.getBirthByIdCard(ID_18);
|
||||||
|
Reference in New Issue
Block a user