mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -49,7 +49,7 @@ public class Issue2131Test {
|
||||
@Data
|
||||
static class GoodsResponse extends BaseResponse {
|
||||
// 由于定义成了final形式,setXXX无效,导致无法注入。
|
||||
private final List<GoodsItem> collections = ListUtil.list(false);
|
||||
private final List<GoodsItem> collections = ListUtil.of(false);
|
||||
}
|
||||
|
||||
@Data
|
||||
|
@@ -19,7 +19,7 @@ public class IssueI1AU86Test {
|
||||
|
||||
@Test
|
||||
public void toListTest() {
|
||||
final List<String> redisList = ListUtil.toList(
|
||||
final List<String> redisList = ListUtil.of(
|
||||
"{\"updateDate\":1583376342000,\"code\":\"move\",\"id\":1,\"sort\":1,\"name\":\"电影大全\"}",
|
||||
"{\"updateDate\":1583378882000,\"code\":\"zy\",\"id\":3,\"sort\":5,\"name\":\"综艺会\"}"
|
||||
);
|
||||
|
@@ -42,7 +42,7 @@ public class JSONArrayTest {
|
||||
|
||||
@Test
|
||||
public void addNullTest(){
|
||||
final List<String> aaa = ListUtil.of("aaa", null);
|
||||
final List<String> aaa = ListUtil.view("aaa", null);
|
||||
final String jsonStr = JSONUtil.toJsonStr(JSONUtil.parse(aaa,
|
||||
JSONConfig.create().setIgnoreNullValue(false)));
|
||||
Assert.assertEquals("[\"aaa\",null]", jsonStr);
|
||||
@@ -97,7 +97,7 @@ public class JSONArrayTest {
|
||||
b2.setAkey("aValue2");
|
||||
b2.setBkey("bValue2");
|
||||
|
||||
final ArrayList<KeyBean> list = ListUtil.toList(b1, b2);
|
||||
final ArrayList<KeyBean> list = ListUtil.of(b1, b2);
|
||||
|
||||
final JSONArray jsonArray = JSONUtil.parseArray(list);
|
||||
Assert.assertEquals("aValue1", jsonArray.getJSONObject(0).getStr("akey"));
|
||||
|
@@ -238,7 +238,7 @@ public class JSONObjectTest {
|
||||
userA.setA("A user");
|
||||
userA.setName("{\n\t\"body\":{\n\t\t\"loginId\":\"id\",\n\t\t\"password\":\"pwd\"\n\t}\n}");
|
||||
userA.setDate(new Date());
|
||||
userA.setSqs(ListUtil.toList(new Seq("seq1"), new Seq("seq2")));
|
||||
userA.setSqs(ListUtil.of(new Seq("seq1"), new Seq("seq2")));
|
||||
|
||||
final JSONObject json = JSONUtil.parseObj(userA);
|
||||
final UserA userA2 = json.toBean(UserA.class);
|
||||
@@ -320,7 +320,7 @@ public class JSONObjectTest {
|
||||
final UserA userA = new UserA();
|
||||
userA.setName("nameTest");
|
||||
userA.setDate(new Date());
|
||||
userA.setSqs(ListUtil.toList(new Seq(null), new Seq("seq2")));
|
||||
userA.setSqs(ListUtil.of(new Seq(null), new Seq("seq2")));
|
||||
|
||||
final JSONObject json = JSONUtil.parseObj(userA, false);
|
||||
|
||||
@@ -333,7 +333,7 @@ public class JSONObjectTest {
|
||||
final TestBean bean = new TestBean();
|
||||
bean.setDoubleValue(111.1);
|
||||
bean.setIntValue(123);
|
||||
bean.setList(ListUtil.toList("a", "b", "c"));
|
||||
bean.setList(ListUtil.of("a", "b", "c"));
|
||||
bean.setStrValue("strTest");
|
||||
bean.setTestEnum(TestEnum.TYPE_B);
|
||||
|
||||
|
@@ -58,7 +58,7 @@ public class JSONUtilTest {
|
||||
a2.setDate(DateUtil.date());
|
||||
a2.setName("AAAA222Name");
|
||||
|
||||
final ArrayList<UserA> list = ListUtil.toList(a1, a2);
|
||||
final ArrayList<UserA> list = ListUtil.of(a1, a2);
|
||||
final HashMap<String, Object> map = MapUtil.newHashMap();
|
||||
map.put("total", 13);
|
||||
map.put("rows", list);
|
||||
@@ -229,7 +229,7 @@ public class JSONUtilTest {
|
||||
public void toXmlTest(){
|
||||
final JSONObject obj = JSONUtil.createObj();
|
||||
obj.set("key1", "v1")
|
||||
.set("key2", ListUtil.of("a", "b", "c"));
|
||||
.set("key2", ListUtil.view("a", "b", "c"));
|
||||
final String xmlStr = JSONUtil.toXmlStr(obj);
|
||||
Assert.assertEquals("<key1>v1</key1><key2>a</key2><key2>b</key2><key2>c</key2>", xmlStr);
|
||||
}
|
||||
|
@@ -24,12 +24,12 @@ public class ParseBeanTest {
|
||||
c2.setTest("test2");
|
||||
|
||||
final B b1 = new B();
|
||||
b1.setCs(ListUtil.toList(c1, c2));
|
||||
b1.setCs(ListUtil.of(c1, c2));
|
||||
final B b2 = new B();
|
||||
b2.setCs(ListUtil.toList(c1, c2));
|
||||
b2.setCs(ListUtil.of(c1, c2));
|
||||
|
||||
final A a = new A();
|
||||
a.setBs(ListUtil.toList(b1, b2));
|
||||
a.setBs(ListUtil.of(b1, b2));
|
||||
|
||||
final JSONObject json = JSONUtil.parseObj(a);
|
||||
final A a1 = JSONUtil.toBean(json, A.class);
|
||||
|
Reference in New Issue
Block a user