mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add test
This commit is contained in:
parent
ce86e51af8
commit
a25a707e3a
@ -1135,11 +1135,17 @@ public class DateUtilTest {
|
||||
*/
|
||||
@Test
|
||||
public void ageOfNowTest() {
|
||||
DateTime concurrentDate = DateUtil.date();
|
||||
DateTime birthDay = DateUtil.offset(concurrentDate, DateField.YEAR, -71);
|
||||
final DateTime concurrentDate = DateUtil.date();
|
||||
final DateTime birthDay = DateUtil.offset(concurrentDate, DateField.YEAR, -71);
|
||||
Assert.assertEquals(70, DateUtil.ageOfNow(birthDay));
|
||||
Assert.assertEquals(71, DateUtil.ageOfNow(DateUtil.offsetDay(birthDay, -1)));
|
||||
Assert.assertEquals(0, DateUtil.ageOfNow(concurrentDate));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void calendarTest() {
|
||||
final Date date = DateUtil.date();
|
||||
final Calendar c = DateUtil.calendar(date);
|
||||
Assert.assertEquals(DateUtil.date(c), date);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user