mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add test
This commit is contained in:
parent
a5e9f119b6
commit
41c540f4ca
@ -1777,7 +1777,7 @@ public class DateUtil {
|
||||
* @param startDate 开始时间
|
||||
* @param dateField 时间单位
|
||||
* @param timeLength 时长
|
||||
* @param checkedDate 被比较的时间。如果经过时长后的时间晚于被检查的时间,就表示过期
|
||||
* @param checkedDate 被比较的时间,即有效期的截止时间。如果经过时长后的时间晚于被检查的时间,就表示过期
|
||||
* @return 是否过期
|
||||
* @since 3.1.1
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@ package cn.hutool.core.date;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.BetweenFormater.Level;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -624,4 +625,13 @@ public class DateUtilTest {
|
||||
final int age = DateUtil.age(DateUtil.parseDate(d1), DateUtil.parseDate(d2));
|
||||
Assert.assertEquals(18, age);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isExpiredTest(){
|
||||
DateTime startDate = DateUtil.parse("2019-12-01 17:02:30");
|
||||
DateTime endDate = DateUtil.parse("2019-12-02 17:02:30");
|
||||
int length = 3;
|
||||
boolean expired = DateUtil.isExpired(startDate, DateField.DAY_OF_YEAR, length, endDate);
|
||||
Assert.assertTrue(expired);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user