Package jodd.json.mock

Examples of jodd.json.mock.Group


  @Test
  public void testArrayType() {
    Person igor = creator.createJodder();
    Person modesty = creator.createModesty();

    Group group = new Group("brothers", igor, modesty);
    String json = new JsonSerializer().include("people").exclude("*.class").serialize(group);
    Group bro = new JsonParser().map(Group.class).parse(json);

    assertNotNull(bro);
    assertEquals("brothers", bro.getGroupName());
    assertEquals(2, bro.getPeople().length);
    assertEquals("Igor", bro.getPeople()[0].getFirstname());
    assertEquals("Modesty", bro.getPeople()[1].getFirstname());
  }
View Full Code Here


    assertEquals("Modesty", bro.getPeople()[1].getFirstname());
  }

  @Test
  public void testEmptyArray() {
    Group group = new JsonParser().parse("{\"people\": [], \"groupName\": \"Nobody\" }", Group.class);
    assertEquals("Nobody", group.getGroupName());
    assertEquals(0, group.getPeople().length);
  }
View Full Code Here

TOP

Related Classes of jodd.json.mock.Group

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.