use of org.apache.beam.sdk.schemas.utils.TestPOJOs.AnnotatedSimplePojo in project beam by apache.
the class JavaFieldSchemaTest method testAnnotations.
@Test
public void testAnnotations() throws NoSuchSchemaException {
SchemaRegistry registry = SchemaRegistry.createDefault();
Schema schema = registry.getSchema(AnnotatedSimplePojo.class);
SchemaTestUtils.assertSchemaEquivalent(ANNOTATED_SIMPLE_POJO_SCHEMA, schema);
Row simpleRow = createAnnotatedRow("string");
AnnotatedSimplePojo pojo = createAnnotated("string");
assertEquals(simpleRow, registry.getToRowFunction(AnnotatedSimplePojo.class).apply(pojo));
AnnotatedSimplePojo pojo2 = registry.getFromRowFunction(AnnotatedSimplePojo.class).apply(simpleRow);
assertEquals(pojo, pojo2);
}
Aggregations