use of org.springframework.data.jdbc.repository.QueryMappingConfiguration in project spring-data-jdbc by spring-projects.
the class EnableJdbcRepositoriesIntegrationTests method customRowMapperConfigurationGetsPickedUp.
// DATAJDBC-166
@Test
public void customRowMapperConfigurationGetsPickedUp() {
QueryMappingConfiguration mapping = (QueryMappingConfiguration) ReflectionUtils.getField(MAPPER_MAP, factoryBean);
assertThat(mapping.getRowMapper(String.class)).isEqualTo(STRING_ROW_MAPPER);
assertThat(mapping.getRowMapper(DummyEntity.class)).isEqualTo(DUMMY_ENTITY_ROW_MAPPER);
}
use of org.springframework.data.jdbc.repository.QueryMappingConfiguration in project spring-data-jdbc by spring-projects.
the class ConfigurableRowMapperMapUnitTests method returnsNullForClassNotConfigured.
// DATAJDBC-166
@Test
public void returnsNullForClassNotConfigured() {
RowMapper rowMapper = mock(RowMapper.class);
QueryMappingConfiguration map = new DefaultQueryMappingConfiguration().registerRowMapper(Number.class, rowMapper);
assertThat(map.getRowMapper(Integer.class)).isNull();
assertThat(map.getRowMapper(String.class)).isNull();
}
use of org.springframework.data.jdbc.repository.QueryMappingConfiguration in project spring-data-jdbc by spring-projects.
the class ConfigurableRowMapperMapUnitTests method returnsInstanceRegisteredForSubClass.
// DATAJDBC-166
@Test
public void returnsInstanceRegisteredForSubClass() {
RowMapper rowMapper = mock(RowMapper.class);
QueryMappingConfiguration map = new DefaultQueryMappingConfiguration().registerRowMapper(String.class, rowMapper);
assertThat(map.getRowMapper(Object.class)).isEqualTo(rowMapper);
}
use of org.springframework.data.jdbc.repository.QueryMappingConfiguration in project spring-data-jdbc by spring-projects.
the class ConfigurableRowMapperMapUnitTests method freshInstanceReturnsNull.
// DATAJDBC-166
@Test
public void freshInstanceReturnsNull() {
QueryMappingConfiguration map = new DefaultQueryMappingConfiguration();
assertThat(map.getRowMapper(Object.class)).isNull();
}
use of org.springframework.data.jdbc.repository.QueryMappingConfiguration in project spring-data-jdbc by spring-projects.
the class ConfigurableRowMapperMapUnitTests method prefersExactTypeMatchClass.
// DATAJDBC-166
@Test
public void prefersExactTypeMatchClass() {
RowMapper rowMapper = mock(RowMapper.class);
QueryMappingConfiguration map = //
new DefaultQueryMappingConfiguration().registerRowMapper(Object.class, //
mock(RowMapper.class)).registerRowMapper(Integer.class, //
rowMapper).registerRowMapper(Number.class, mock(RowMapper.class));
assertThat(map.getRowMapper(Integer.class)).isEqualTo(rowMapper);
}
Aggregations