use of org.apache.beam.sdk.schemas.utils.TestJavaBeans.BeanWithByteArray in project beam by apache.
the class JavaBeanUtilsTest method testGeneratedByteBufferSetters.
@Test
public void testGeneratedByteBufferSetters() {
BeanWithByteArray bean = new BeanWithByteArray();
List<FieldValueSetter> setters = JavaBeanUtils.getSetters(BeanWithByteArray.class, BEAN_WITH_BYTE_ARRAY_SCHEMA, new SetterTypeSupplier(), new DefaultTypeConversionsFactory());
setters.get(0).set(bean, "field1".getBytes(StandardCharsets.UTF_8));
setters.get(1).set(bean, "field2".getBytes(StandardCharsets.UTF_8));
assertArrayEquals("not equal", "field1".getBytes(StandardCharsets.UTF_8), bean.getBytes1());
assertEquals(ByteBuffer.wrap("field2".getBytes(StandardCharsets.UTF_8)), bean.getBytes2());
}
Aggregations