Search in sources :

Example 1 with WithOptionalComplexTypeDefaults

use of com.linkedin.pegasus.generator.test.idl.records.WithOptionalComplexTypeDefaults in project rest.li by linkedin.

the class RecordGeneratorTest method testWithOptionalComplexTypesDefaults.

@Test
public void testWithOptionalComplexTypesDefaults() {
    WithOptionalComplexTypeDefaults withDefaults = new WithOptionalComplexTypeDefaults();
    Simple simple = new Simple();
    simple.setMessage("defaults!");
    assertEquals(withDefaults.getRecord(), simple);
    assertEquals(withDefaults.getEnum(), Fruits.APPLE);
    assertEquals(withDefaults.getUnion(), WithComplexTypeDefaults.Union.create(1));
    IntegerArray intArray = new IntegerArray();
    intArray.add(1);
    assertEquals(withDefaults.getArray(), intArray);
    IntegerMap intMap = new IntegerMap();
    intMap.put("a", 1);
    assertEquals(withDefaults.getMap(), intMap);
    assertEquals(withDefaults.getCustom(), new CustomInt(1));
}
Also used : IntegerMap(com.linkedin.data.template.IntegerMap) WithOptionalComplexTypeDefaults(com.linkedin.pegasus.generator.test.idl.records.WithOptionalComplexTypeDefaults) CustomInt(com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt) Simple(com.linkedin.pegasus.generator.test.idl.records.Simple) IntegerArray(com.linkedin.data.template.IntegerArray) Test(org.testng.annotations.Test)

Aggregations

IntegerArray (com.linkedin.data.template.IntegerArray)1 IntegerMap (com.linkedin.data.template.IntegerMap)1 Simple (com.linkedin.pegasus.generator.test.idl.records.Simple)1 WithOptionalComplexTypeDefaults (com.linkedin.pegasus.generator.test.idl.records.WithOptionalComplexTypeDefaults)1 CustomInt (com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt)1 Test (org.testng.annotations.Test)1