Assert.assertThat(u2[1].getName(), is("user1"));
}
@Test
public void test9() {
MapObj m = new MapObj();
Map<String, Integer> map = new HashMap<String, Integer>();
map.put("a1", 40);
m.setMap(map);
Map<String, User[]> userMap = new HashMap<String, User[]>();
List<User> users = new ArrayList<User>();
for (int j = 0; j < 3; j++) {
User user = new User();
user.setId((long)j);
user.setName("user" + j);
users.add(user);
}
User[] u = users.toArray(new User[0]);
userMap.put("user1", u);
users = new ArrayList<User>();
for (int j = 10; j < 12; j++) {
User user = new User();
user.setId((long)j);
user.setName("user_b" + j);
users.add(user);
}
u = users.toArray(new User[0]);
userMap.put("user2", u);
m.setUserMap(userMap);
Map<String, int[]> map3 = new HashMap<String, int[]>();
map3.put("m31", new int[]{3,4,5,6});
map3.put("m32", new int[]{7,8,9});
m.map3 = map3;
String json = Json.toJson(m);
MapObj m2 = Json.toObject(json, MapObj.class);
Assert.assertThat(m2.getMap().get("a1"), is(40));
Assert.assertThat(m.getUserMap().get("user1").length, is(3));
Assert.assertThat(m.getUserMap().get("user2").length, is(2));
Assert.assertThat(m.getUserMap().get("user2")[0].getName(), is("user_b10"));
Assert.assertThat(m2.map3.get("m31")[3], is(6));
}