use of com.linkedin.pegasus.generator.test.idl.arrays.WithCustomTypesArrayUnionArray in project rest.li by linkedin.
the class ArrayGeneratorTest method testWithCustomTypesArray.
@Test
public void testWithCustomTypesArray() throws Throwable {
String json = load("WithCustomTypesArray.json");
WithCustomTypesArray original = new WithCustomTypesArray();
CustomIntArray ints = new CustomIntArray();
ints.add(new CustomInt(1));
ints.add(new CustomInt(2));
ints.add(new CustomInt(3));
original.setInts(ints);
SimpleArrayArray arrays = new SimpleArrayArray();
SimpleArray simpleArray = new SimpleArray();
Simple simple = new Simple();
simple.setMessage("a1");
simpleArray.add(simple);
arrays.add(simpleArray);
original.setArrays(arrays);
SimpleMapArray maps = new SimpleMapArray();
SimpleMap map = new SimpleMap();
Simple simplem1 = new Simple();
simplem1.setMessage("m1");
map.put("a", simplem1);
maps.add(map);
original.setMaps(maps);
Simple simpleu1 = new Simple();
simpleu1.setMessage("u1");
WithCustomTypesArrayUnionArray unions = new WithCustomTypesArrayUnionArray();
unions.add(WithCustomTypesArrayUnion.create(1));
unions.add(WithCustomTypesArrayUnion.create("str"));
unions.add(WithCustomTypesArrayUnion.create(simpleu1));
original.setUnions(unions);
Fixed8 fixed8 = new Fixed8(SchemaFixtures.bytesFixed8);
Fixed8Array fixed8Array = new Fixed8Array();
fixed8Array.add(fixed8);
original.setFixed(fixed8Array);
assertJson(original, json);
WithCustomTypesArray roundTripped = new WithCustomTypesArray(roundTrip(original.data()));
assertJson(roundTripped, json);
}
Aggregations