mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
add methods
This commit is contained in:
@@ -751,7 +751,7 @@ public class DateUtilTest {
|
||||
String strDate1 = DateUtil.formatLocalDateTime(ldt);
|
||||
Assert.assertEquals(strDate, strDate1);
|
||||
|
||||
String strDate2 = "2019年12月01日 17:02:30.111";
|
||||
String strDate2 = "2019-12-01 17:02:30.111";
|
||||
ldt = DateUtil.parseLocalDateTime(strDate2, DatePattern.NORM_DATETIME_MS_PATTERN);
|
||||
strDate1 = DateUtil.format(ldt, DatePattern.NORM_DATETIME_PATTERN);
|
||||
Assert.assertEquals(strDate, strDate1);
|
||||
|
@@ -4,6 +4,7 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
@@ -58,6 +59,15 @@ public class LocalDateTimeUtilTest {
|
||||
Assert.assertEquals("2020-01-23T12:23:56", localDateTime.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseDateTest() {
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate("2020-01-23");
|
||||
Assert.assertEquals("2020-01-23", localDate.toString());
|
||||
|
||||
localDate = LocalDateTimeUtil.parseDate("2020-01-23T12:23:56", DateTimeFormatter.ISO_DATE_TIME);
|
||||
Assert.assertEquals("2020-01-23", localDate.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void formatTest() {
|
||||
final LocalDateTime localDateTime = LocalDateTimeUtil.parse("2020-01-23T12:23:56");
|
||||
@@ -68,6 +78,13 @@ public class LocalDateTimeUtilTest {
|
||||
Assert.assertEquals("2020-01-23", format);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void formatLocalDateTest() {
|
||||
final LocalDate localDateTime = LocalDate.parse("2020-01-23");
|
||||
String format = LocalDateTimeUtil.format(localDateTime, DatePattern.NORM_DATE_PATTERN);
|
||||
Assert.assertEquals("2020-01-23", format);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void offset() {
|
||||
final LocalDateTime localDateTime = LocalDateTimeUtil.parse("2020-01-23T12:23:56");
|
||||
|
@@ -1,10 +1,9 @@
|
||||
package cn.hutool.core.io.checksum;
|
||||
|
||||
import cn.hutool.core.util.HexUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import cn.hutool.core.util.HexUtil;
|
||||
|
||||
/**
|
||||
* CRC校验单元测试
|
||||
*
|
||||
|
Reference in New Issue
Block a user