mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -225,7 +225,7 @@ public class JSONUtil {
|
||||
* @throws IORuntimeException IO异常
|
||||
*/
|
||||
public static JSON readJSON(final File file, final Charset charset) throws IORuntimeException {
|
||||
return parse(FileReader.create(file, charset).readString());
|
||||
return parse(FileReader.of(file, charset).readString());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,7 +237,7 @@ public class JSONUtil {
|
||||
* @throws IORuntimeException IO异常
|
||||
*/
|
||||
public static JSONObject readJSONObject(final File file, final Charset charset) throws IORuntimeException {
|
||||
return parseObj(FileReader.create(file, charset).readString());
|
||||
return parseObj(FileReader.of(file, charset).readString());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,7 +249,7 @@ public class JSONUtil {
|
||||
* @throws IORuntimeException IO异常
|
||||
*/
|
||||
public static JSONArray readJSONArray(final File file, final Charset charset) throws IORuntimeException {
|
||||
return parseArray(FileReader.create(file, charset).readString());
|
||||
return parseArray(FileReader.of(file, charset).readString());
|
||||
}
|
||||
// -------------------------------------------------------------------- Read end
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package cn.hutool.json;
|
||||
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.date.TimeUtil;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -20,12 +20,12 @@ public class Issue644Test {
|
||||
final JSONObject jsonObject = JSONUtil.parseObj(beanWithDate);
|
||||
|
||||
BeanWithDate beanWithDate2 = JSONUtil.toBean(jsonObject, BeanWithDate.class);
|
||||
Assert.assertEquals(LocalDateTimeUtil.formatNormal(beanWithDate.getDate()),
|
||||
LocalDateTimeUtil.formatNormal(beanWithDate2.getDate()));
|
||||
Assert.assertEquals(TimeUtil.formatNormal(beanWithDate.getDate()),
|
||||
TimeUtil.formatNormal(beanWithDate2.getDate()));
|
||||
|
||||
beanWithDate2 = JSONUtil.toBean(jsonObject.toString(), BeanWithDate.class);
|
||||
Assert.assertEquals(LocalDateTimeUtil.formatNormal(beanWithDate.getDate()),
|
||||
LocalDateTimeUtil.formatNormal(beanWithDate2.getDate()));
|
||||
Assert.assertEquals(TimeUtil.formatNormal(beanWithDate.getDate()),
|
||||
TimeUtil.formatNormal(beanWithDate2.getDate()));
|
||||
}
|
||||
|
||||
@Data
|
||||
|
Reference in New Issue
Block a user