Search in sources :

Example 1 with EmptyArray

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

the class ArrayGeneratorTest method testWithRecordArray.

@Test
public void testWithRecordArray() throws Throwable {
    String json = load("WithRecordArray.json");
    EmptyArray empties = new EmptyArray();
    empties.add(new Empty());
    empties.add(new Empty());
    empties.add(new Empty());
    FruitsArray fruitsArray = new FruitsArray();
    fruitsArray.add(Fruits.APPLE);
    fruitsArray.add(Fruits.BANANA);
    fruitsArray.add(Fruits.ORANGE);
    WithRecordArray original = new WithRecordArray();
    original.setEmpties(empties);
    original.setFruits(fruitsArray);
    assertJson(original, json);
    WithRecordArray roundTripped = new WithRecordArray(roundTrip(original.data()));
    assertJson(roundTripped, json);
}
Also used : Empty(com.linkedin.pegasus.generator.test.idl.records.Empty) FruitsArray(com.linkedin.pegasus.generator.test.idl.enums.FruitsArray) EmptyArray(com.linkedin.pegasus.generator.test.idl.records.EmptyArray) WithRecordArray(com.linkedin.pegasus.generator.test.idl.arrays.WithRecordArray) Test(org.testng.annotations.Test)

Example 2 with EmptyArray

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

the class TyperefGeneratorTest method testWithComplexTyperefs.

@Test
public void testWithComplexTyperefs() throws Throwable {
    WithComplexTyperefs original = new WithComplexTyperefs();
    original.setEnum(Fruits.APPLE);
    original.setRecord(new Empty());
    EmptyMap emptyMap = new EmptyMap();
    emptyMap.put("a", new Empty());
    original.setMap(emptyMap);
    EmptyArray emptyArray = new EmptyArray();
    emptyArray.add(new Empty());
    original.setArray(emptyArray);
    original.setUnion(UnionTyperef.create(1));
    WithComplexTyperefs roundTripped = new WithComplexTyperefs(roundTrip(original.data()));
    assertEquals(original.data(), roundTripped.data());
}
Also used : Empty(com.linkedin.pegasus.generator.test.idl.records.Empty) EmptyArray(com.linkedin.pegasus.generator.test.idl.records.EmptyArray) WithComplexTyperefs(com.linkedin.pegasus.generator.test.idl.records.WithComplexTyperefs) EmptyMap(com.linkedin.pegasus.generator.test.idl.records.EmptyMap) Test(org.testng.annotations.Test)

Aggregations

Empty (com.linkedin.pegasus.generator.test.idl.records.Empty)2 EmptyArray (com.linkedin.pegasus.generator.test.idl.records.EmptyArray)2 Test (org.testng.annotations.Test)2 WithRecordArray (com.linkedin.pegasus.generator.test.idl.arrays.WithRecordArray)1 FruitsArray (com.linkedin.pegasus.generator.test.idl.enums.FruitsArray)1 EmptyMap (com.linkedin.pegasus.generator.test.idl.records.EmptyMap)1 WithComplexTyperefs (com.linkedin.pegasus.generator.test.idl.records.WithComplexTyperefs)1