mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add method
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package cn.hutool.core.date;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -133,10 +132,12 @@ public class DateTimeTest {
|
||||
Assert.assertEquals(1, date.weekOfYear());
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 严格模式下,不允许非常规的数字,如秒部分最多59,99则报错
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void ofTest(){
|
||||
String a = "2021-09-27 00:00:99";
|
||||
final DateTime dateTime = new DateTime(a, DatePattern.NORM_DATETIME_FORMAT);
|
||||
Console.log(dateTime);
|
||||
new DateTime(a, DatePattern.NORM_DATETIME_FORMAT, false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user