Search in sources :

Example 1 with POJOWithByteArray

use of org.apache.beam.sdk.schemas.utils.TestPOJOs.POJOWithByteArray in project beam by apache.

the class POJOUtilsTest method testGeneratedByteBufferSetters.

@Test
public void testGeneratedByteBufferSetters() {
    POJOWithByteArray pojo = new POJOWithByteArray();
    List<FieldValueSetter> setters = POJOUtils.getSetters(POJOWithByteArray.class, POJO_WITH_BYTE_ARRAY_SCHEMA, JavaFieldTypeSupplier.INSTANCE, new DefaultTypeConversionsFactory());
    setters.get(0).set(pojo, BYTE_ARRAY);
    setters.get(1).set(pojo, BYTE_BUFFER.array());
    assertArrayEquals("not equal", BYTE_ARRAY, pojo.bytes1);
    assertEquals(BYTE_BUFFER, pojo.bytes2);
}
Also used : DefaultTypeConversionsFactory(org.apache.beam.sdk.schemas.utils.ByteBuddyUtils.DefaultTypeConversionsFactory) FieldValueSetter(org.apache.beam.sdk.schemas.FieldValueSetter) POJOWithByteArray(org.apache.beam.sdk.schemas.utils.TestPOJOs.POJOWithByteArray) Test(org.junit.Test)

Aggregations

FieldValueSetter (org.apache.beam.sdk.schemas.FieldValueSetter)1 DefaultTypeConversionsFactory (org.apache.beam.sdk.schemas.utils.ByteBuddyUtils.DefaultTypeConversionsFactory)1 POJOWithByteArray (org.apache.beam.sdk.schemas.utils.TestPOJOs.POJOWithByteArray)1 Test (org.junit.Test)1