mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix bug
This commit is contained in:
@@ -189,9 +189,8 @@ public class JSONObjectTest {
|
||||
public void toBeanTest3() {
|
||||
String jsonStr = "{'data':{'userName':'ak','password': null}}";
|
||||
UserWithMap user = JSONUtil.toBean(JSONUtil.parseObj(jsonStr), UserWithMap.class);
|
||||
String password = user.getData().get("password");
|
||||
Assert.assertTrue(user.getData().containsKey("password"));
|
||||
Assert.assertNull(password);
|
||||
// Bean默认忽略null
|
||||
Assert.assertFalse(user.getData().containsKey("password"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -1,15 +1,10 @@
|
||||
package cn.hutool.json.test.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class UserWithMap {
|
||||
private Map<String, String> data;
|
||||
|
||||
public Map<String, String> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Map<String, String> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user