@SuppressWarnings("unchecked") @Test public void test_should_search_meterStatus() { final Map<String, Object> preparedStatementValues = new HashMap<>(); when(meterStatusQueryBuilder.getQuery(getMeterStatusGetRequest(), preparedStatementValues)) .thenReturn("Select ms.id as ms_id,ms.code as ms_code," + "ms.status as ms_status,ms.description as ms_description,ms.createdby as" + " ms_createdby,ms.createddate as ms_createddate,ms.lastmodifiedby as ms_" + "lastmodifiedby,ms.lastmodifieddate as ms_lastmodifieddate,ms.tenantid as" + " ms_tenantid FROM egwtr_meterstatus ms WHERE ms.tenantId = ? AND " + "ms.id IN (1, 2) ORDER BY status desc"); when(namedParameterJdbcTemplate.query(any(String.class), anyMap(), any(MeterStatusRowMapper.class))) .thenReturn(getListOfMeterStatuses()); assertTrue(getListOfMeterStatuses().equals(meterStatusRepository.getMeterStatusByCriteria(getMeterStatusGetRequest()))); }
public List<MeterStatus> getMeterStatusByCriteria(final MeterStatusGetRequest meterStatusGetRequest) { final Map<String, Object> preparedStatementValues = new HashMap<>(); final String queryString = meterStatusQueryBuilder.getQuery(meterStatusGetRequest, preparedStatementValues); return namedParameterJdbcTemplate.query(queryString, preparedStatementValues, meterStatusRowMapper); }
MeterStatusRepository { public List<MeterStatus> getMeterStatusByCriteria(final MeterStatusGetRequest meterStatusGetRequest) { final Map<String, Object> preparedStatementValues = new HashMap<>(); final String queryString = meterStatusQueryBuilder.getQuery(meterStatusGetRequest, preparedStatementValues); return namedParameterJdbcTemplate.query(queryString, preparedStatementValues, meterStatusRowMapper); } }
MeterStatusRepository { public List<MeterStatus> getMeterStatusByCriteria(final MeterStatusGetRequest meterStatusGetRequest) { final Map<String, Object> preparedStatementValues = new HashMap<>(); final String queryString = meterStatusQueryBuilder.getQuery(meterStatusGetRequest, preparedStatementValues); return namedParameterJdbcTemplate.query(queryString, preparedStatementValues, meterStatusRowMapper); }  }
MeterStatusRepository { public List<MeterStatus> getMeterStatusByCriteria(final MeterStatusGetRequest meterStatusGetRequest) { final Map<String, Object> preparedStatementValues = new HashMap<>(); final String queryString = meterStatusQueryBuilder.getQuery(meterStatusGetRequest, preparedStatementValues); return namedParameterJdbcTemplate.query(queryString, preparedStatementValues, meterStatusRowMapper); }  List<MeterStatus> pushCreateToQueue(final MeterStatusReq meterStatusReq); MeterStatusReq create(final MeterStatusReq meterStatusRequest); List<MeterStatus> pushUpdateToQueue(final MeterStatusReq meterStatusRequest); MeterStatusReq update(final MeterStatusReq meterStatusRequest); List<MeterStatus> getMeterStatusByCriteria(final MeterStatusGetRequest meterStatusGetRequest); }
MeterStatusRepository { public List<MeterStatus> getMeterStatusByCriteria(final MeterStatusGetRequest meterStatusGetRequest) { final Map<String, Object> preparedStatementValues = new HashMap<>(); final String queryString = meterStatusQueryBuilder.getQuery(meterStatusGetRequest, preparedStatementValues); return namedParameterJdbcTemplate.query(queryString, preparedStatementValues, meterStatusRowMapper); }  List<MeterStatus> pushCreateToQueue(final MeterStatusReq meterStatusReq); MeterStatusReq create(final MeterStatusReq meterStatusRequest); List<MeterStatus> pushUpdateToQueue(final MeterStatusReq meterStatusRequest); MeterStatusReq update(final MeterStatusReq meterStatusRequest); List<MeterStatus> getMeterStatusByCriteria(final MeterStatusGetRequest meterStatusGetRequest); static final Logger logger; }