use of org.jdbi.v3.core.mapper.ValueTypeMapper in project jdbi by jdbi.
the class BeanMapperTest method shouldUseRegisteredMapperForUnknownPropertyType.
@Test
public void shouldUseRegisteredMapperForUnknownPropertyType() throws Exception {
handle.registerColumnMapper(new ValueTypeMapper());
mockColumns("longField", "valueTypeField");
Long expected = 123L;
when(resultSet.getLong(1)).thenReturn(expected);
when(resultSet.getString(2)).thenReturn("foo");
when(resultSet.wasNull()).thenReturn(false);
SampleBean sampleBean = mapper.map(resultSet, ctx);
assertThat(sampleBean.getLongField()).isEqualTo(expected);
assertThat(sampleBean.getValueTypeField()).isEqualTo(ValueType.valueOf("foo"));
}
use of org.jdbi.v3.core.mapper.ValueTypeMapper in project jdbi by jdbi.
the class FieldMapperTest method shouldUseRegisteredMapperForUnknownPropertyType.
@Test
public void shouldUseRegisteredMapperForUnknownPropertyType() throws Exception {
handle.registerColumnMapper(new ValueTypeMapper());
mockColumns("longField", "valueTypeField");
when(resultSet.getLong(1)).thenReturn(123L);
when(resultSet.getString(2)).thenReturn("foo");
when(resultSet.wasNull()).thenReturn(false);
SampleBean sampleBean = mapper.map(resultSet, ctx);
Long expected = 123L;
assertThat(sampleBean.getLongField()).isEqualTo(expected);
assertThat(sampleBean.getValueTypeField()).isEqualTo(ValueType.valueOf("foo"));
}
Aggregations