mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
add method
This commit is contained in:
@@ -197,4 +197,24 @@ public class LocalDateTimeUtilTest {
|
||||
Assert.assertTrue(LocalDateTimeUtil.isOverlap(oneStartTime2,oneEndTime2,realStartTime,realEndTime));
|
||||
Assert.assertFalse(LocalDateTimeUtil.isOverlap(oneStartTime3,oneEndTime3,realStartTime,realEndTime));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void weekOfYearTest(){
|
||||
LocalDate date1 = LocalDate.of(2021, 12, 31);
|
||||
final int weekOfYear1 = LocalDateTimeUtil.weekOfYear(date1);
|
||||
Assert.assertEquals(weekOfYear1, 52);
|
||||
|
||||
final int weekOfYear2 = LocalDateTimeUtil.weekOfYear(date1.atStartOfDay());
|
||||
Assert.assertEquals(weekOfYear2, 52);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void weekOfYearTest2(){
|
||||
LocalDate date1 = LocalDate.of(2022, 1, 31);
|
||||
final int weekOfYear1 = LocalDateTimeUtil.weekOfYear(date1);
|
||||
Assert.assertEquals(weekOfYear1, 52);
|
||||
|
||||
final int weekOfYear2 = LocalDateTimeUtil.weekOfYear(date1.atStartOfDay());
|
||||
Assert.assertEquals(weekOfYear2, 52);
|
||||
}
|
||||
}
|
||||
|
@@ -37,4 +37,15 @@ public class MonthTest {
|
||||
lastDay = Month.of(Calendar.DECEMBER).getLastDay(true);
|
||||
Assert.assertEquals(31, lastDay);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toJdkMonthTest(){
|
||||
final java.time.Month month = Month.AUGUST.toJdkMonth();
|
||||
Assert.assertEquals(java.time.Month.AUGUST, month);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void toJdkMonthTest2(){
|
||||
Month.UNDECIMBER.toJdkMonth();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user