Search in sources :

Example 1 with WithComplexTypeDefaults

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

the class RecordGeneratorTest method testWithComplexTypesDefaults.

@Test
public void testWithComplexTypesDefaults() {
    WithComplexTypeDefaults withDefaults = new WithComplexTypeDefaults();
    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) WithComplexTypeDefaults(com.linkedin.pegasus.generator.test.idl.records.WithComplexTypeDefaults) 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 WithComplexTypeDefaults (com.linkedin.pegasus.generator.test.idl.records.WithComplexTypeDefaults)1 CustomInt (com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt)1 Test (org.testng.annotations.Test)1