Search in sources :

Example 1 with RepositoryQuery

use of org.springframework.data.repository.query.RepositoryQuery in project spring-data-jdbc by spring-projects.

the class JdbcQueryLookupStrategyUnitTests method typeBasedRowMapperGetsUsedForQuery.

// DATAJDBC-166
@Test
public void typeBasedRowMapperGetsUsedForQuery() {
    RowMapper numberFormatMapper = mock(RowMapper.class);
    RowMapperMap rowMapperMap = new ConfigurableRowMapperMap().register(NumberFormat.class, numberFormatMapper);
    RepositoryQuery repositoryQuery = getRepositoryQuery("returningNumberFormat", rowMapperMap);
    repositoryQuery.execute(new Object[] {});
    verify(mappingContext.getTemplate()).queryForObject(anyString(), any(SqlParameterSource.class), eq(numberFormatMapper));
}
Also used : RepositoryQuery(org.springframework.data.repository.query.RepositoryQuery) SqlParameterSource(org.springframework.jdbc.core.namedparam.SqlParameterSource) RowMapperMap(org.springframework.data.jdbc.repository.RowMapperMap) ConfigurableRowMapperMap(org.springframework.data.jdbc.repository.config.ConfigurableRowMapperMap) ConfigurableRowMapperMap(org.springframework.data.jdbc.repository.config.ConfigurableRowMapperMap) RowMapper(org.springframework.jdbc.core.RowMapper) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 RowMapperMap (org.springframework.data.jdbc.repository.RowMapperMap)1 ConfigurableRowMapperMap (org.springframework.data.jdbc.repository.config.ConfigurableRowMapperMap)1 RepositoryQuery (org.springframework.data.repository.query.RepositoryQuery)1 RowMapper (org.springframework.jdbc.core.RowMapper)1 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)1