private void doOutputParamOverrideTest(DbType templateParamType, DbType overriddenParamType, DbType expectedParamType) throws Exception
{
QueryParam overriddenParam = new DefaultOutputQueryParam(2, overriddenParamType, POSITION_PARAM_NAME);
List<QueryParam> defaultParams = Collections.<QueryParam>singletonList(new DefaultInputQueryParam(1, templateParamType, TEMPLATE_PARAM_VALUE, POSITION_PARAM_NAME));
QueryTemplate queryTemplate = new QueryTemplate(PARSED_PARAMETERIZED_QUERY, QueryType.SELECT, defaultParams);
QueryTemplateParser queryParser = mock(QueryTemplateParser.class);
when(queryParser.parse(PARAMETERIZED_QUERY)).thenReturn(queryTemplate);
List<QueryParam> overriddenParams = Collections.singletonList(overriddenParam);
ParameterizedQueryTemplateFactoryBean factoryBean = new ParameterizedQueryTemplateFactoryBean(PARAMETERIZED_QUERY, overriddenParams, queryParser);
QueryTemplate createdQueryTemplate = factoryBean.getObject();
assertThat(createdQueryTemplate.getParams().size(), equalTo(1));
OutputQueryParam queryParam = createdQueryTemplate.getOutputParams().get(0);
assertThat(queryParam.getIndex(), equalTo(1));
assertThat(queryParam.getType(), equalTo(expectedParamType));
assertThat(queryParam.getName(), equalTo(POSITION_PARAM_NAME));
}