코드 아래 모의 도와주세요 .JdbcTemplate 객체를 호출하는 getDataSource()를 조롱 할 수 없습니다.스프링에서 데이터 소스를 모방하는 방법 JdbcTemplate
@Override
public List<AttributeThresholdRange> getThresholdsRangeForXHS(QueryThresholdsRequest queryThresholdsRequest) {
ArrayOfString attributeGroupIds = queryThresholdsRequest.getAttributeGroupIds();
Map<String, Object> queryParams = new HashMap<>();
queryParams.put("groupids", attributeGroupIds.getStrings());
return new NamedParameterJdbcTemplate(admDatabaseConnector.getJdbcTemplate().getDataSource())
.query(DBQueryConstants.ADM_QUERY_GET_THRESHOLDS_RANGE_FOR_XHS,
queryParams,
new ResultSetExtractor<List<AttributeThresholdRange>>() {
@Override
public List<AttributeThresholdRange> extractData(ResultSet resultSet) throws SQLException,DataAccessException {
return null;
}
});
}
은 admDatabaseConnector autowrired입니까? –
또한 단위 테스트 또는 통합 테스트를 원하십니까? –