use of org.apache.beam.sdk.schemas.utils.TestJavaBeans.BeanWithBoxedFields in project beam by apache.
the class JavaBeanUtilsTest method testGeneratedSimpleBoxedGetters.
@Test
public void testGeneratedSimpleBoxedGetters() {
BeanWithBoxedFields bean = new BeanWithBoxedFields();
bean.setaByte((byte) 41);
bean.setaShort((short) 42);
bean.setAnInt(43);
bean.setaLong(44L);
bean.setaBoolean(true);
List<FieldValueGetter> getters = JavaBeanUtils.getGetters(BeanWithBoxedFields.class, BEAN_WITH_BOXED_FIELDS_SCHEMA, new JavaBeanSchema.GetterTypeSupplier(), new DefaultTypeConversionsFactory());
assertEquals((byte) 41, getters.get(0).get(bean));
assertEquals((short) 42, getters.get(1).get(bean));
assertEquals((int) 43, getters.get(2).get(bean));
assertEquals((long) 44, getters.get(3).get(bean));
assertTrue((Boolean) getters.get(4).get(bean));
}
use of org.apache.beam.sdk.schemas.utils.TestJavaBeans.BeanWithBoxedFields in project beam by apache.
the class JavaBeanUtilsTest method testGeneratedSimpleBoxedSetters.
@Test
public void testGeneratedSimpleBoxedSetters() {
BeanWithBoxedFields bean = new BeanWithBoxedFields();
List<FieldValueSetter> setters = JavaBeanUtils.getSetters(BeanWithBoxedFields.class, BEAN_WITH_BOXED_FIELDS_SCHEMA, new SetterTypeSupplier(), new DefaultTypeConversionsFactory());
setters.get(0).set(bean, (byte) 41);
setters.get(1).set(bean, (short) 42);
setters.get(2).set(bean, (int) 43);
setters.get(3).set(bean, (long) 44);
setters.get(4).set(bean, true);
assertEquals((byte) 41, bean.getaByte().byteValue());
assertEquals((short) 42, bean.getaShort().shortValue());
assertEquals((int) 43, bean.getAnInt().intValue());
assertEquals((long) 44, bean.getaLong().longValue());
assertTrue(bean.getaBoolean().booleanValue());
}
Aggregations