AttributeOptionComboLoader { public CategoryOptionCombo getDefault() { return loadCategoryOptionCombo( IdScheme.NAME, "default" ); } AttributeOptionComboLoader( @Qualifier( "readOnlyJdbcTemplate" ) JdbcTemplate jdbcTemplate ); CategoryOptionCombo getCategoryOptionCombo( IdScheme idScheme, String id ); CategoryOptionCombo getAttributeOptionCombo( CategoryCombo categoryCombo, String categoryOptions,
                                                        String attributeOptionCombo, IdScheme idScheme ); CategoryOptionCombo getDefault(); final static String SQL_GET_CATEGORYOPTIONCOMBO; final static String SQL_GET_CATEGORYOPTIONCOMBO_BY_CATEGORYIDS; }
@Test public void verifyGetDefaultCategoryOptionCombo() { when( jdbcTemplate.queryForObject( anyString(), any( RowMapper.class ) ) ) .thenReturn( new CategoryOptionCombo() ); CategoryOptionCombo categoryOptionCombo = subject.getDefault(); assertThat( categoryOptionCombo, is( notNullValue() ) ); verify( jdbcTemplate ).queryForObject( sqlCaptor.capture(), any( RowMapper.class ) ); final String sql = sqlCaptor.getValue(); assertThat( sql, is( replace( SQL_GET_CATEGORYOPTIONCOMBO, "key", "categoryoptioncomboid", "resolvedScheme", "name = 'default'" ) ) ); }