use of jodd.json.mock.Group in project jodd by oblac.
the class JSONDeserializerTest method testArrayType.
@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());
}
use of jodd.json.mock.Group in project jodd by oblac.
the class JSONDeserializerTest method testEmptyArray.
@Test
public void testEmptyArray() {
Group group = new JsonParser().parse("{\"people\": [], \"groupName\": \"Nobody\" }", Group.class);
assertEquals("Nobody", group.getGroupName());
assertEquals(0, group.getPeople().length);
}
Aggregations