use of com.linkedin.data.template.HasTyperefInfo in project rest.li by linkedin.
the class TestTyperefUnion method testNonTyperefUnion.
@Test
public void testNonTyperefUnion() {
TyperefInfo typerefInfo = DataTemplateUtil.getTyperefInfo(TestRecordAndUnionTemplate.Foo.Union.class);
assertNull(typerefInfo);
TestRecordAndUnionTemplate.Foo.Union union = new TestRecordAndUnionTemplate.Foo.Union();
assertFalse(union instanceof HasTyperefInfo);
}
use of com.linkedin.data.template.HasTyperefInfo in project rest.li by linkedin.
the class TestTyperefUnion method testTyperefUnion.
@Test
public void testTyperefUnion() {
TyperefInfo typerefInfo = DataTemplateUtil.getTyperefInfo(Union.class);
assertNotNull(typerefInfo);
TyperefDataSchema typerefDataSchema = typerefInfo.getSchema();
Union union = new Union();
assertTrue(union instanceof HasTyperefInfo);
TyperefInfo typerefInfoFromInstance = union.typerefInfo();
assertNotNull(typerefInfoFromInstance);
TyperefDataSchema typerefDataSchemaFromInstance = typerefInfo.getSchema();
assertSame(typerefDataSchemaFromInstance, typerefDataSchema);
assertSame(typerefInfoFromInstance, typerefInfo);
assertEquals(typerefDataSchema.getFullName(), Union.class.getName());
assertEquals(typerefDataSchema.getRef(), DataTemplateUtil.getSchema(Union.class));
}
Aggregations