Package test.utils.json

Examples of test.utils.json.ArrayObj


       Assert.assertThat(r.getImages().get(0).getHeight(), is(768));
  }
 
  @Test
  public void test7() {
    ArrayObj obj = new ArrayObj();
    Integer[] i = new Integer[]{2,3,4,5,6,332};
    obj.setNumbers(i);
   
    long[][] map = new long[][]{{3L, 44L, 55L}, {24, 324, 3}};
    obj.setMap(map);
   
    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);
    }
    obj.setUsers(users.toArray(new User[0]));
   
    String json = Json.toJson(obj);
   
    ArrayObj obj2 = Json.toObject(json, ArrayObj.class);
    Assert.assertThat(obj2.getNumbers()[3], is(5));
    Assert.assertThat(obj2.getNumbers().length, is(6));
    Assert.assertThat(obj2.getMap().length, is(2));
    Assert.assertThat(obj2.getMap()[0][1], is(44L));
    Assert.assertThat(obj2.getUsers().length, is(3));
    Assert.assertThat(obj2.getUsers()[0].getId(), is(0L));
    Assert.assertThat(obj2.getUsers()[1].getName(), is("user1"));
  }
View Full Code Here

TOP

Related Classes of test.utils.json.ArrayObj

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.