@Test public void test_should_get_all_statuses_as_Per_criteria() { when(statusQueryBuilder.getQuery(any(StatusCriteria.class), any(List.class))).thenReturn(""); when(jdbcTemplate.query(any(String.class), any(Object[].class), any(StatusRowMapper.class))) .thenReturn(getStatusModel()); List<Status> actualStatuses = statusRepository.getStatuses(getStatusCriteria()); assertTrue(actualStatuses.get(0).equals(getStatusModel().get(0))); }
public List<Status> getStatuses(StatusCriteria criteria) { List<Object> preparedStatementValues = new ArrayList<>(); String queryString = statusQueryBuilder.getQuery(criteria, preparedStatementValues); return jdbcTemplate.query(queryString, preparedStatementValues.toArray(), statusRowMapper); }
StatusRepository { public List<Status> getStatuses(StatusCriteria criteria) { List<Object> preparedStatementValues = new ArrayList<>(); String queryString = statusQueryBuilder.getQuery(criteria, preparedStatementValues); return jdbcTemplate.query(queryString, preparedStatementValues.toArray(), statusRowMapper); } }
StatusRepository { public List<Status> getStatuses(StatusCriteria criteria) { List<Object> preparedStatementValues = new ArrayList<>(); String queryString = statusQueryBuilder.getQuery(criteria, preparedStatementValues); return jdbcTemplate.query(queryString, preparedStatementValues.toArray(), statusRowMapper); }  }
StatusRepository { public List<Status> getStatuses(StatusCriteria criteria) { List<Object> preparedStatementValues = new ArrayList<>(); String queryString = statusQueryBuilder.getQuery(criteria, preparedStatementValues); return jdbcTemplate.query(queryString, preparedStatementValues.toArray(), statusRowMapper); }  List<Status> getStatuses(StatusCriteria criteria); }
StatusRepository { public List<Status> getStatuses(StatusCriteria criteria) { List<Object> preparedStatementValues = new ArrayList<>(); String queryString = statusQueryBuilder.getQuery(criteria, preparedStatementValues); return jdbcTemplate.query(queryString, preparedStatementValues.toArray(), statusRowMapper); }  List<Status> getStatuses(StatusCriteria criteria);  }