use of org.springframework.data.jdbc.repository.config.DefaultQueryMappingConfiguration in project spring-data-jdbc by spring-projects.
the class JdbcQueryLookupStrategyUnitTests method prefersDeclaredQuery.
// GH-1061
@Test
void prefersDeclaredQuery() {
RowMapper<? extends NumberFormat> numberFormatMapper = mock(RowMapper.class);
QueryMappingConfiguration mappingConfiguration = new DefaultQueryMappingConfiguration().registerRowMapper(NumberFormat.class, numberFormatMapper);
RepositoryQuery repositoryQuery = getRepositoryQuery("annotatedQueryWithQueryAndQueryName", mappingConfiguration);
repositoryQuery.execute(new Object[] {});
verify(operations).queryForObject(eq("some SQL"), any(SqlParameterSource.class), any(RowMapper.class));
}
use of org.springframework.data.jdbc.repository.config.DefaultQueryMappingConfiguration in project spring-data-jdbc by spring-projects.
the class JdbcQueryLookupStrategyUnitTests method typeBasedRowMapperGetsUsedForQuery.
// DATAJDBC-166
@Test
@SuppressWarnings("unchecked")
void typeBasedRowMapperGetsUsedForQuery() {
RowMapper<? extends NumberFormat> numberFormatMapper = mock(RowMapper.class);
QueryMappingConfiguration mappingConfiguration = new DefaultQueryMappingConfiguration().registerRowMapper(NumberFormat.class, numberFormatMapper);
RepositoryQuery repositoryQuery = getRepositoryQuery("returningNumberFormat", mappingConfiguration);
repositoryQuery.execute(new Object[] {});
verify(operations).queryForObject(anyString(), any(SqlParameterSource.class), any(RowMapper.class));
}
Aggregations