!1214 [新特性] 新增加了四种农历日期的标准输出

Merge pull request !1214 from eventiming/v6-dev
This commit is contained in:
Looly
2024-04-26 07:35:23 +00:00
committed by Gitee
3 changed files with 138 additions and 5 deletions

View File

@@ -200,4 +200,24 @@ public class ChineseDateTest {
Assertions.assertEquals(chineseDate2, chineseDate3);
Assertions.assertNotEquals(chineseDate2, chineseDate4);
}
@Test
public void getNormalizedDateTest(){
final Date date = DateUtil.parse("2024-4-24");
final Date date2 = DateUtil.parse("2024-4-30");
final ChineseDate chineseDate = new ChineseDate(date);
final ChineseDate chineseDate2 = new ChineseDate(date2);
Assertions.assertEquals("公元2024年农历甲辰年三月十六", chineseDate.getNormalizedDate());
Assertions.assertEquals("农历甲辰年三月十六", chineseDate.getNormalizedDate(ChineseDate.ChineseDateFormat.GSS));
Assertions.assertEquals("农历龙年三月十六", chineseDate.getNormalizedDate(ChineseDate.ChineseDateFormat.XSS));
Assertions.assertEquals("农历甲辰年三月戊午日", chineseDate.getNormalizedDate(ChineseDate.ChineseDateFormat.GSG));
Assertions.assertEquals("公元2024年农历甲辰年三月十六", chineseDate.getNormalizedDate(ChineseDate.ChineseDateFormat.Mix));
Assertions.assertEquals("公元2024年农历甲辰年三月廿二", chineseDate2.getNormalizedDate());
Assertions.assertEquals("农历甲辰年三月廿二", chineseDate2.getNormalizedDate(ChineseDate.ChineseDateFormat.GSS));
Assertions.assertEquals("农历龙年三月廿二", chineseDate2.getNormalizedDate(ChineseDate.ChineseDateFormat.XSS));
Assertions.assertEquals("农历甲辰年三月甲子日", chineseDate2.getNormalizedDate(ChineseDate.ChineseDateFormat.GSG));
Assertions.assertEquals("公元2024年农历甲辰年三月廿二", chineseDate2.getNormalizedDate(ChineseDate.ChineseDateFormat.Mix));
}
}