Search in sources :

Example 1 with AnnotatedSimplePojo

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);
}
Also used : AnnotatedSimplePojo(org.apache.beam.sdk.schemas.utils.TestPOJOs.AnnotatedSimplePojo) Row(org.apache.beam.sdk.values.Row) Test(org.junit.Test)

Aggregations

AnnotatedSimplePojo (org.apache.beam.sdk.schemas.utils.TestPOJOs.AnnotatedSimplePojo)1 Row (org.apache.beam.sdk.values.Row)1 Test (org.junit.Test)1