use of com.linkedin.data.template.DirectArrayTemplate in project rest.li by linkedin.
the class TestSchemaSampleDataGenerator method testArraySchema.
@Test
public void testArraySchema() {
for (Map.Entry<DataSchema.Type, Class<? extends DirectArrayTemplate<?>>> entry : _dataSchemaTypeToprimitiveArrayMap.entrySet()) {
final PrimitiveDataSchema itemsSchema = DataSchemaUtil.dataSchemaTypeToPrimitiveDataSchema(entry.getKey());
final ArrayDataSchema arraySchema = new ArrayDataSchema(itemsSchema);
final DataList value = (DataList) SchemaSampleDataGenerator.buildData(arraySchema, _spec);
final ParameterizedType arrayType = (ParameterizedType) entry.getValue().getGenericSuperclass();
assert (arrayType.getRawType() == DirectArrayTemplate.class);
Assert.assertSame(value.get(0).getClass(), arrayType.getActualTypeArguments()[0]);
}
}
Aggregations