use of com.linkedin.pegasus.generator.test.idl.records.WithComplexTypes in project rest.li by linkedin.
the class RecordGeneratorTest method testWithComplexTypes.
@Test
public void testWithComplexTypes() throws Throwable {
WithComplexTypes original = new WithComplexTypes();
Simple simple = new Simple();
simple.setMessage("message");
original.setRecord(simple);
original.setEnum(Fruits.APPLE);
original.setUnion(WithComplexTypes.Union.create(1));
IntegerArray intArray = new IntegerArray();
intArray.add(1);
original.setArray(intArray);
IntegerMap intMap = new IntegerMap();
intMap.put("a", 1);
original.setMap(intMap);
SimpleMap simpleMap = new SimpleMap();
simpleMap.put("a", simple);
original.setComplexMap(simpleMap);
original.setCustom(new CustomInt(1));
WithComplexTypes roundTripped = new WithComplexTypes(roundTrip(original.data()));
assertEquals(roundTripped.getRecord(), simple);
assertEquals(roundTripped.getEnum(), Fruits.APPLE);
}
Aggregations