use of org.jdbi.v3.core.SampleBean in project jdbi by jdbi.
the class BeanMapperTest method shouldBeCaseInSensitiveOfColumnWithUnderscoresAndPropertyNames.
@Test
public void shouldBeCaseInSensitiveOfColumnWithUnderscoresAndPropertyNames() throws Exception {
mockColumns("LoNg_FiElD");
Long aLongVal = 100L;
mockLongResult(aLongVal);
SampleBean sampleBean = mapper.map(resultSet, ctx);
assertThat(sampleBean.getLongField()).isEqualTo(aLongVal);
}
use of org.jdbi.v3.core.SampleBean in project jdbi by jdbi.
the class BeanMapperTest method shouldHandleEmptyResult.
@Test
public void shouldHandleEmptyResult() throws Exception {
mockColumns();
SampleBean sampleBean = mapper.map(resultSet, ctx);
assertThat(sampleBean).isNotNull();
}
use of org.jdbi.v3.core.SampleBean in project jdbi by jdbi.
the class BeanMapperTest method shouldHandleColumNameWithUnderscores.
@Test
public void shouldHandleColumNameWithUnderscores() throws Exception {
mockColumns("LONG_FIELD");
Long aLongVal = 100L;
mockLongResult(aLongVal);
SampleBean sampleBean = mapper.map(resultSet, ctx);
assertThat(sampleBean.getLongField()).isEqualTo(aLongVal);
}
use of org.jdbi.v3.core.SampleBean in project jdbi by jdbi.
the class BeanMapperTest method shouldHandleNullValue.
@Test
public void shouldHandleNullValue() throws Exception {
mockColumns("LoNgfielD");
mockAllNullsResult();
SampleBean sampleBean = mapper.map(resultSet, ctx);
assertThat(sampleBean.getLongField()).isNull();
}
use of org.jdbi.v3.core.SampleBean in project jdbi by jdbi.
the class FieldMapperTest method shouldSetValueOnPrivateField.
@Test
public void shouldSetValueOnPrivateField() throws Exception {
mockColumns("longField");
Long aLongVal = 100L;
when(resultSet.getLong(1)).thenReturn(aLongVal);
when(resultSet.wasNull()).thenReturn(false);
SampleBean sampleBean = mapper.map(resultSet, ctx);
assertThat(sampleBean.getLongField()).isEqualTo(aLongVal);
}
Aggregations