ParameterDAO { public Set<String> getParameterNames() { SelectQuery query = QueryFactory.select("name").from(configuration.parameterEntityName()); return new HashSet<String>(simpleQueryRunner.queryList(query, new StringMapper())); } ParameterDAO(JdbcConfig configuration, SimpleQueryRunner simpleQueryRunner); long insert(QueryRunner queryRunner, Parameter parameter); void delete(QueryRunner queryRunner, String parameterName); Set<String> getParameterNames(); List<String> getParameterNames(ParameterFilter filter); JdbcParameter getParameter(QueryRunner queryRunner, String parameterName); boolean parameterExists(String parameterName); void update(QueryRunner queryRunner, String parameterName, Parameter parameter);  }
@Test public void shouldReturnListOfSortedParameterNames() { database().withParameters(5).build(); ParameterDAO parameterDAO = get(ParameterDAO.class); ParameterFilter filter = new ParameterFilter(SortDirection.DESC); List<String> parameters = parameterDAO.getParameterNames(filter); assertThat(parameters).containsExactly("parameter4", "parameter3", "parameter2", "parameter1", "parameter0"); }
@Test public void shouldReturnFilteredListOfParameterNames() { database().withParameters(5).build(); ParameterDAO parameterDAO = get(ParameterDAO.class); ParameterFilter filter = new ParameterFilter("*4"); List<String> parameters = parameterDAO.getParameterNames(filter); assertThat(parameters).containsExactly("parameter4"); }