forked from alibaba/fastjson
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBug2.java
More file actions
executable file
·64 lines (43 loc) · 1.52 KB
/
Copy pathBug2.java
File metadata and controls
executable file
·64 lines (43 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.alibaba.json.bvt.bug;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.fastjson.JSON;
public class Bug2 extends TestCase {
public void test_0() throws Exception {
Entity entity = new Entity();
entity.setArticles(Collections.singletonList(new Article()));
String jsonString = JSON.toJSONString(entity);
System.out.println(jsonString);
Entity entity2 = JSON.parseObject(jsonString, Entity.class);
Assert.assertEquals(entity.getArticles().size(), entity2.getArticles().size());
}
public static class Entity {
private List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
private List<Article> articles = null;
public List<HashMap<String, String>> getList() {
return list;
}
public void setList(List<HashMap<String, String>> list) {
this.list = list;
}
public List<Article> getArticles() {
return articles;
}
public void setArticles(List<Article> articles) {
this.articles = articles;
}
}
public static class Article {
private long id;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
}