mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add test
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
package cn.hutool.core.date;
|
||||
|
||||
import cn.hutool.core.date.BetweenFormatter.Level;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class DateBetweenTest {
|
||||
|
||||
@Test
|
||||
@@ -36,6 +37,14 @@ public class DateBetweenTest {
|
||||
assertEquals(18, betweenYear);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void betweenYearTest3() {
|
||||
Date start = DateUtil.parse("20170301");
|
||||
Date end = DateUtil.parse("2024-02-29 14:56:18");
|
||||
long betweenYear = new DateBetween(start, end).betweenYear(false);
|
||||
assertEquals(6, betweenYear);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void betweenMonthTest() {
|
||||
Date start = DateUtil.parse("2017-02-01 12:23:46");
|
||||
|
Reference in New Issue
Block a user