use of com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt 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(Collections.singletonList(1));
assertEquals(withDefaults.getArray(), intArray);
IntegerMap intMap = new IntegerMap();
intMap.put("a", 1);
assertEquals(withDefaults.getMap(), intMap);
assertEquals(withDefaults.getCustom(), new CustomInt(1));
}
use of com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt 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(Collections.singletonList(1));
assertEquals(withDefaults.getArray(), intArray);
IntegerMap intMap = new IntegerMap();
intMap.put("a", 1);
assertEquals(withDefaults.getMap(), intMap);
assertEquals(withDefaults.getCustom(), new CustomInt(1));
}
use of com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt in project rest.li by linkedin.
the class UnionGeneratorTest method testWithPrimitiveCustomTypesUnion.
@Test
public void testWithPrimitiveCustomTypesUnion() throws Throwable {
String json = load("WithPrimitiveCustomTypesUnion_int.json");
WithPrimitiveCustomTypesUnion original = new WithPrimitiveCustomTypesUnion();
original.setUnion(WithPrimitiveCustomTypesUnion.Union.create(new CustomInt(1)));
assertJson(original, json);
WithPrimitiveCustomTypesUnion roundTripped = new WithPrimitiveCustomTypesUnion(roundTrip(original.data()));
assertJson(roundTripped, json);
}
Aggregations