mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add method
This commit is contained in:
@@ -17,7 +17,7 @@ public class DateConvertTest {
|
||||
final Date value = Convert.toDate(a);
|
||||
Assert.assertEquals(a, DateUtil.formatDate(value));
|
||||
|
||||
final long timeLong = DateUtil.date().getTime();
|
||||
final long timeLong = DateUtil.now().getTime();
|
||||
final Date value2 = Convert.toDate(timeLong);
|
||||
Assert.assertEquals(timeLong, value2.getTime());
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class DateConvertTest {
|
||||
final java.sql.Date value = Convert.convert(java.sql.Date.class, a);
|
||||
Assert.assertEquals("2017-05-06", value.toString());
|
||||
|
||||
final long timeLong = DateUtil.date().getTime();
|
||||
final long timeLong = DateUtil.now().getTime();
|
||||
final java.sql.Date value2 = Convert.convert(java.sql.Date.class, timeLong);
|
||||
Assert.assertEquals(timeLong, value2.getTime());
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ public class DateUtilTest {
|
||||
@Test
|
||||
public void nowTest() {
|
||||
// 当前时间
|
||||
final Date date = DateUtil.date();
|
||||
final Date date = DateUtil.now();
|
||||
Assert.assertNotNull(date);
|
||||
// 当前时间
|
||||
final Date date2 = DateUtil.date(Calendar.getInstance());
|
||||
@@ -56,6 +56,12 @@ public class DateUtilTest {
|
||||
Assert.assertNotNull(today);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void todayTest() {
|
||||
final String s = DateUtil.today().toString();
|
||||
Assert.assertTrue(s.endsWith("00:00:00"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void formatAndParseTest() {
|
||||
final String dateStr = "2017-03-01";
|
||||
@@ -737,7 +743,7 @@ public class DateUtilTest {
|
||||
|
||||
@Test
|
||||
public void endOfYearTest() {
|
||||
final DateTime date = DateUtil.date();
|
||||
final DateTime date = DateUtil.now();
|
||||
date.setField(DateField.YEAR, 2019);
|
||||
final DateTime endOfYear = DateUtil.endOfYear(date);
|
||||
Assert.assertEquals("2019-12-31 23:59:59", endOfYear.toString());
|
||||
|
@@ -229,7 +229,7 @@ public class UrlBuilderTest {
|
||||
@Test
|
||||
public void endWithSlashTest() {
|
||||
// 原URL中以/结尾,则这个规则需保留,issue#I1G44J@Gitee
|
||||
final String today = DateUtil.date().toString("yyyyMMdd");
|
||||
final String today = DateUtil.now().toString("yyyyMMdd");
|
||||
final String getWorkDayUrl = "https://tool.bitefu.net/jiari/?info=1&d=" + today;
|
||||
final UrlBuilder builder = UrlBuilder.ofHttp(getWorkDayUrl, CharsetUtil.UTF_8);
|
||||
Assert.assertEquals(getWorkDayUrl, builder.toString());
|
||||
|
Reference in New Issue
Block a user