use of org.apache.beam.sdk.schemas.utils.TestPOJOs.POJOWithBoxedFields in project beam by apache.
the class POJOUtilsTest method testGeneratedSimpleBoxedGetters.
@Test
public void testGeneratedSimpleBoxedGetters() {
POJOWithBoxedFields pojo = new POJOWithBoxedFields((byte) 41, (short) 42, 43, 44L, true);
List<FieldValueGetter> getters = POJOUtils.getGetters(POJOWithBoxedFields.class, POJO_WITH_BOXED_FIELDS_SCHEMA, JavaFieldTypeSupplier.INSTANCE, new DefaultTypeConversionsFactory());
assertEquals((byte) 41, getters.get(0).get(pojo));
assertEquals((short) 42, getters.get(1).get(pojo));
assertEquals((int) 43, getters.get(2).get(pojo));
assertEquals((long) 44, getters.get(3).get(pojo));
assertTrue((Boolean) getters.get(4).get(pojo));
}
use of org.apache.beam.sdk.schemas.utils.TestPOJOs.POJOWithBoxedFields in project beam by apache.
the class POJOUtilsTest method testGeneratedSimpleBoxedSetters.
@Test
public void testGeneratedSimpleBoxedSetters() {
POJOWithBoxedFields pojo = new POJOWithBoxedFields();
List<FieldValueSetter> setters = POJOUtils.getSetters(POJOWithBoxedFields.class, POJO_WITH_BOXED_FIELDS_SCHEMA, JavaFieldTypeSupplier.INSTANCE, new DefaultTypeConversionsFactory());
setters.get(0).set(pojo, (byte) 41);
setters.get(1).set(pojo, (short) 42);
setters.get(2).set(pojo, (int) 43);
setters.get(3).set(pojo, (long) 44);
setters.get(4).set(pojo, true);
assertEquals((byte) 41, pojo.aByte.byteValue());
assertEquals((short) 42, pojo.aShort.shortValue());
assertEquals((int) 43, pojo.anInt.intValue());
assertEquals((long) 44, pojo.aLong.longValue());
assertTrue(pojo.aBoolean.booleanValue());
}
Aggregations