forked from json-iterator/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestNested.java
More file actions
24 lines (21 loc) · 759 Bytes
/
TestNested.java
File metadata and controls
24 lines (21 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.jsoniter;
import junit.framework.TestCase;
import org.junit.Assert;
import java.io.IOException;
public class TestNested extends TestCase {
public void test_array_of_objects() throws IOException {
Jsoniter iter = Jsoniter.parse(
"[{'field1':'11','field2':'12'},{'field1':'21','field2':'22'}]".replace('\'', '"'));
SimpleObject[] objects = iter.read(SimpleObject[].class);
Assert.assertArrayEquals(new SimpleObject[]{
new SimpleObject() {{
field1 = "11";
field2 = "12";
}},
new SimpleObject() {{
field1 = "21";
field2 = "22";
}}
}, objects);
}
}