use of com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt in project rest.li by linkedin.
the class ArrayGeneratorTest method testWithCustomTypesArray.
@Test
public void testWithCustomTypesArray() throws Throwable {
String json = load("WithCustomTypesArray.json");
SimpleMap map = new SimpleMap();
map.put("a", new Simple().setMessage("m1"));
WithCustomTypesArray original = new WithCustomTypesArray().setInts(new CustomIntArray(new CustomInt(1), new CustomInt(2), new CustomInt(3))).setArrays(new SimpleArrayArray(new SimpleArray(new Simple().setMessage("a1")))).setMaps(new SimpleMapArray(map)).setUnions(new WithCustomTypesArrayUnionArray(WithCustomTypesArrayUnion.create(1), WithCustomTypesArrayUnion.create("str"), WithCustomTypesArrayUnion.create(new Simple().setMessage("u1")))).setFixed(new Fixed8Array(new Fixed8(SchemaFixtures.bytesFixed8)));
assertJson(original, json);
WithCustomTypesArray roundTripped = new WithCustomTypesArray(roundTrip(original.data()));
assertJson(roundTripped, json);
}
use of com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt in project rest.li by linkedin.
the class RecordGeneratorTest method testWithComplexTypes.
@Test
public void testWithComplexTypes() throws Throwable {
Simple simple = new Simple();
simple.setMessage("message");
IntegerMap intMap = new IntegerMap();
intMap.put("a", 1);
SimpleMap simpleMap = new SimpleMap();
simpleMap.put("a", simple);
WithComplexTypes original = new WithComplexTypes().setRecord(simple).setEnum(Fruits.APPLE).setUnion(WithComplexTypes.Union.create(1)).setArray(new IntegerArray(Collections.singletonList(1))).setMap(intMap).setComplexMap(simpleMap).setCustom(new CustomInt(1));
WithComplexTypes roundTripped = new WithComplexTypes(roundTrip(original.data()));
assertEquals(roundTripped.getRecord(), simple);
assertEquals(roundTripped.getEnum(), Fruits.APPLE);
}
use of com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt in project rest.li by linkedin.
the class RecordGeneratorTest method testWithPrimitiveCustomTypes.
@Test
public void testWithPrimitiveCustomTypes() throws Throwable {
WithPrimitiveCustomTypes original = new WithPrimitiveCustomTypes();
original.setIntField(new CustomInt(1));
assertJson(original, load("WithPrimitiveCustomTypes.json"));
WithPrimitiveCustomTypes roundTripped = new WithPrimitiveCustomTypes(roundTrip(original.data()));
assertEquals(roundTripped.getIntField(), new CustomInt(1));
assertJson(roundTripped, load("WithPrimitiveCustomTypes.json"));
}
use of com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt in project rest.li by linkedin.
the class MapGeneratorTest method testWithCustomTypesMap.
@Test
public void testWithCustomTypesMap() throws Throwable {
String json = load("WithCustomTypesMap.json");
WithCustomTypesMap original = new WithCustomTypesMap();
CustomIntMap ints = new CustomIntMap();
ints.put("a", new CustomInt(1));
ints.put("b", new CustomInt(2));
ints.put("c", new CustomInt(3));
original.setInts(ints);
assertJson(original, json);
WithCustomTypesMap roundTripped = new WithCustomTypesMap(roundTrip(original.data()));
assertJson(roundTripped, json);
}
use of com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt in project rest.li by linkedin.
the class RecordGeneratorTest method testWithOptionalPrimitiveCustomTypes.
@Test
public void testWithOptionalPrimitiveCustomTypes() throws Throwable {
WithOptionalPrimitiveCustomTypes original = new WithOptionalPrimitiveCustomTypes();
original.setIntField(new CustomInt(1));
WithOptionalPrimitiveCustomTypes roundTripped = new WithOptionalPrimitiveCustomTypes(roundTrip(original.data()));
assertEquals(roundTripped.getIntField(), new CustomInt(1));
}
Aggregations