use of com.linkedin.pegasus.generator.test.idl.maps.WithPrimitivesMap in project rest.li by linkedin.
the class MapGeneratorTest method testWithPrimitivesMap.
@Test
public void testWithPrimitivesMap() throws Throwable {
String json = load("WithPrimitivesMap.json");
WithPrimitivesMap original = new WithPrimitivesMap();
IntegerMap ints = new IntegerMap();
ints.put("a", 1);
ints.put("b", 2);
ints.put("c", 3);
original.setInts(ints);
LongMap longs = new LongMap();
longs.put("a", 10L);
longs.put("b", 20L);
longs.put("c", 30L);
original.setLongs(longs);
FloatMap floats = new FloatMap();
floats.put("a", 1.1f);
floats.put("b", 2.2f);
floats.put("c", 3.3f);
original.setFloats(floats);
DoubleMap doubles = new DoubleMap();
doubles.put("a", 11.1d);
doubles.put("b", 22.2d);
doubles.put("c", 33.3d);
original.setDoubles(doubles);
BooleanMap booleans = new BooleanMap();
booleans.put("a", true);
booleans.put("b", false);
booleans.put("c", true);
original.setBooleans(booleans);
StringMap strings = new StringMap();
strings.put("a", "string1");
strings.put("b", "string2");
strings.put("c", "string3");
original.setStrings(strings);
BytesMap bytes = new BytesMap();
bytes.put("a", SchemaFixtures.bytes1);
bytes.put("b", SchemaFixtures.bytes2);
bytes.put("c", SchemaFixtures.bytes3);
original.setBytes(bytes);
assertJson(original, json);
WithPrimitivesMap roundTripped = new WithPrimitivesMap(roundTrip(original.data()));
assertJson(roundTripped, json);
}
Aggregations