mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复提示信息错误
This commit is contained in:
@@ -3,6 +3,8 @@ package cn.hutool.core.date;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class ZodiacTest {
|
||||
|
||||
@Test
|
||||
@@ -10,6 +12,12 @@ public class ZodiacTest {
|
||||
Assert.assertEquals("摩羯座", Zodiac.getZodiac(Month.JANUARY, 19));
|
||||
Assert.assertEquals("水瓶座", Zodiac.getZodiac(Month.JANUARY, 20));
|
||||
Assert.assertEquals("巨蟹座", Zodiac.getZodiac(6, 17));
|
||||
|
||||
final Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(2022, Calendar.JULY, 17);
|
||||
Assert.assertEquals("巨蟹座", Zodiac.getZodiac(calendar.getTime()));
|
||||
Assert.assertEquals("巨蟹座", Zodiac.getZodiac(calendar));
|
||||
Assert.assertNull(Zodiac.getZodiac((Calendar) null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -17,5 +25,12 @@ public class ZodiacTest {
|
||||
Assert.assertEquals("狗", Zodiac.getChineseZodiac(1994));
|
||||
Assert.assertEquals("狗", Zodiac.getChineseZodiac(2018));
|
||||
Assert.assertEquals("猪", Zodiac.getChineseZodiac(2019));
|
||||
|
||||
final Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(2022, Calendar.JULY, 17);
|
||||
Assert.assertEquals("虎", Zodiac.getChineseZodiac(calendar.getTime()));
|
||||
Assert.assertEquals("虎", Zodiac.getChineseZodiac(calendar));
|
||||
Assert.assertNull(Zodiac.getChineseZodiac(1899));
|
||||
Assert.assertNull(Zodiac.getChineseZodiac((Calendar) null));
|
||||
}
|
||||
}
|
||||
|
15
hutool-core/src/test/java/cn/hutool/core/date/ZoneUtilTest.java
Executable file
15
hutool-core/src/test/java/cn/hutool/core/date/ZoneUtilTest.java
Executable file
@@ -0,0 +1,15 @@
|
||||
package cn.hutool.core.date;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class ZoneUtilTest {
|
||||
@Test
|
||||
public void toTest() {
|
||||
Assert.assertEquals(ZoneId.systemDefault(), ZoneUtil.toZoneId(null));
|
||||
Assert.assertEquals(TimeZone.getDefault(), ZoneUtil.toTimeZone(null));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user