This commit is contained in:
Looly
2020-05-30 07:51:45 +08:00
parent 7d97896c00
commit e7bc77aff5
3 changed files with 31 additions and 10 deletions

View File

@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.BetweenFormater.Level;
import cn.hutool.core.date.format.FastDateFormat;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import java.text.SimpleDateFormat;
@@ -380,14 +379,6 @@ public class DateUtilTest {
Assert.assertEquals("2019-06-01 19:45:43", dateTime.toString());
}
@Test
@Ignore
public void parseTest8() {
String str = "2020-04-24 9:00:00";
DateTime dateTime = DateUtil.parse(str);
Assert.assertEquals("2019-06-01 19:45:43", dateTime.toString());
}
@Test
public void parseAndOffsetTest() {
// 检查UTC时间偏移是否准确
@@ -762,4 +753,12 @@ public class DateUtilTest {
final long weekCount = DateUtil.betweenWeek(start, end, true);
Assert.assertEquals(30L, weekCount);
}
@Test
public void dayOfYearTest() {
int dayOfYear = DateUtil.dayOfYear(DateUtil.parse("2020-01-01"));
Assert.assertEquals(1, dayOfYear);
int lengthOfYear = DateUtil.lengthOfYear(2020);
Assert.assertEquals(366, lengthOfYear);
}
}