use of com.linkedin.pegasus.generator.test.idl.unions.WithComplexTypesUnion in project rest.li by linkedin.
the class UnionGeneratorTest method testWithComplexTypesUnion.
@Test
public void testWithComplexTypesUnion() throws Throwable {
WithComplexTypesUnion.Union recordMember = WithComplexTypesUnion.Union.create(new Empty());
WithComplexTypesUnion.Union enumMember = WithComplexTypesUnion.Union.create(Fruits.APPLE);
SimpleMap simpleMap = new SimpleMap();
Simple m1 = new Simple();
m1.setMessage("m1");
simpleMap.put("a", m1);
WithComplexTypesUnion.Union mapMember = WithComplexTypesUnion.Union.create(simpleMap);
SimpleArray simpleArray = new SimpleArray();
Simple a1 = new Simple();
a1.setMessage("a1");
simpleArray.add(a1);
WithComplexTypesUnion.Union arrayMember = WithComplexTypesUnion.Union.create(simpleArray);
WithComplexTypesUnion withRecord = new WithComplexTypesUnion();
withRecord.setUnion(recordMember);
assertJson(withRecord, load("WithComplexTypesUnion_Empty.json"));
WithComplexTypesUnion withEnum = new WithComplexTypesUnion();
withEnum.setUnion(enumMember);
assertJson(withEnum, load("WithComplexTypesUnion_Enum.json"));
WithComplexTypesUnion withArray = new WithComplexTypesUnion();
withArray.setUnion(arrayMember);
assertJson(withArray, load("WithComplexTypesUnion_Array.json"));
WithComplexTypesUnion withMap = new WithComplexTypesUnion();
withMap.setUnion(mapMember);
assertJson(withMap, load("WithComplexTypesUnion_Map.json"));
}
Aggregations