use of com.linkedin.data.template.DirectMapTemplate in project rest.li by linkedin.
the class TestSchemaSampleDataGenerator method testMapSchema.
@Test
public void testMapSchema() {
for (Map.Entry<DataSchema.Type, Class<? extends DirectMapTemplate<?>>> entry : _dataSchemaTypeToprimitiveMapMap.entrySet()) {
final PrimitiveDataSchema valueSchema = DataSchemaUtil.dataSchemaTypeToPrimitiveDataSchema(entry.getKey());
final MapDataSchema mapSchema = new MapDataSchema(valueSchema);
final DataMap value = (DataMap) SchemaSampleDataGenerator.buildData(mapSchema, _spec);
final ParameterizedType mapType = (ParameterizedType) entry.getValue().getGenericSuperclass();
assert (mapType.getRawType() == DirectMapTemplate.class);
Assert.assertSame(value.values().iterator().next().getClass(), mapType.getActualTypeArguments()[0]);
}
}
Aggregations