mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-08 06:37:58 +08:00
add test
This commit is contained in:
parent
2954fe0520
commit
a09861b033
@ -28,6 +28,7 @@
|
|||||||
* 【poi 】 修复ExcelUtil.getSaxReader使用非MarkSupport流报错问题(issue#1225@Github)
|
* 【poi 】 修复ExcelUtil.getSaxReader使用非MarkSupport流报错问题(issue#1225@Github)
|
||||||
* 【core 】 修复HexUtil.format问题(issue#I268XT@Gitee)
|
* 【core 】 修复HexUtil.format问题(issue#I268XT@Gitee)
|
||||||
* 【core 】 修复ZipUtil判断压缩文件是否位于压缩目录内的逻辑有误的问题(issue#1251@Github)
|
* 【core 】 修复ZipUtil判断压缩文件是否位于压缩目录内的逻辑有误的问题(issue#1251@Github)
|
||||||
|
* 【json 】 修复JSONObject.accumulate问题
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
|||||||
InternalJSONUtil.testValidity(value);
|
InternalJSONUtil.testValidity(value);
|
||||||
Object object = this.getObj(key);
|
Object object = this.getObj(key);
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
this.set(key, value instanceof JSONArray ? new JSONArray(this.config).set(value) : value);
|
this.set(key, (value instanceof JSONArray) ? value : new JSONArray(this.config).set(value));
|
||||||
} else if (object instanceof JSONArray) {
|
} else if (object instanceof JSONArray) {
|
||||||
((JSONArray) object).set(value);
|
((JSONArray) object).set(value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -535,4 +535,10 @@ public class JSONObjectTest {
|
|||||||
final String s = JSONUtil.toJsonStr(map);
|
final String s = JSONUtil.toJsonStr(map);
|
||||||
Console.log(s);
|
Console.log(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void accumulateTest(){
|
||||||
|
final JSONObject accumulate = JSONUtil.createObj().accumulate("key1", "value1");
|
||||||
|
Assert.assertEquals("{\"key1\":[\"value1\"]}", accumulate.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user