@Test public void test_Should_Find_ReceivingMode_Valid() { final List<Object> preparedStatementValues = new ArrayList<>(); final ReceivingModeTypeGetReq receivingModeGetReq = Mockito.mock(ReceivingModeTypeGetReq.class); final String queryString = "MyQuery"; when(receivingModeQueryBuilder.getQuery(receivingModeGetReq, preparedStatementValues)).thenReturn(queryString); final List< ReceivingModeType> connectionCategories = new ArrayList<>(); when(jdbcTemplate.query(queryString, preparedStatementValues.toArray(), receivingModeRowMapper)) .thenReturn(connectionCategories); assertTrue( connectionCategories.equals(receivingModeRepository.getAllReceivingModeTypes(receivingModeGetReq))); }
public List<ReceivingModeType> getAllReceivingModeTypes(final ReceivingModeTypeGetReq modeTypeGetRequest) { LOGGER.info("ReceivingModeType search Request::" + modeTypeGetRequest); final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = receivingModeTypeQueryBuilder.getQuery(modeTypeGetRequest, preparedStatementValues); ReceivingModeTypeRowMapper receivingModeRowMapper = new ReceivingModeTypeRowMapper(); jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), receivingModeRowMapper); Map<String, ReceivingModeType> modeMap = receivingModeRowMapper.modeMap; Iterator<Entry<String, ReceivingModeType>> itr = modeMap.entrySet().iterator(); List<ReceivingModeType> receivingModeList = new ArrayList<>(); while (itr.hasNext()) { Entry<String, ReceivingModeType> itrEntry = itr.next(); receivingModeList.add(itrEntry.getValue()); } return receivingModeList; }
ReceivingModeTypeRepository { public List<ReceivingModeType> getAllReceivingModeTypes(final ReceivingModeTypeGetReq modeTypeGetRequest) { LOGGER.info("ReceivingModeType search Request::" + modeTypeGetRequest); final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = receivingModeTypeQueryBuilder.getQuery(modeTypeGetRequest, preparedStatementValues); ReceivingModeTypeRowMapper receivingModeRowMapper = new ReceivingModeTypeRowMapper(); jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), receivingModeRowMapper); Map<String, ReceivingModeType> modeMap = receivingModeRowMapper.modeMap; Iterator<Entry<String, ReceivingModeType>> itr = modeMap.entrySet().iterator(); List<ReceivingModeType> receivingModeList = new ArrayList<>(); while (itr.hasNext()) { Entry<String, ReceivingModeType> itrEntry = itr.next(); receivingModeList.add(itrEntry.getValue()); } return receivingModeList; } }
ReceivingModeTypeRepository { public List<ReceivingModeType> getAllReceivingModeTypes(final ReceivingModeTypeGetReq modeTypeGetRequest) { LOGGER.info("ReceivingModeType search Request::" + modeTypeGetRequest); final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = receivingModeTypeQueryBuilder.getQuery(modeTypeGetRequest, preparedStatementValues); ReceivingModeTypeRowMapper receivingModeRowMapper = new ReceivingModeTypeRowMapper(); jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), receivingModeRowMapper); Map<String, ReceivingModeType> modeMap = receivingModeRowMapper.modeMap; Iterator<Entry<String, ReceivingModeType>> itr = modeMap.entrySet().iterator(); List<ReceivingModeType> receivingModeList = new ArrayList<>(); while (itr.hasNext()) { Entry<String, ReceivingModeType> itrEntry = itr.next(); receivingModeList.add(itrEntry.getValue()); } return receivingModeList; }  }
ReceivingModeTypeRepository { public List<ReceivingModeType> getAllReceivingModeTypes(final ReceivingModeTypeGetReq modeTypeGetRequest) { LOGGER.info("ReceivingModeType search Request::" + modeTypeGetRequest); final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = receivingModeTypeQueryBuilder.getQuery(modeTypeGetRequest, preparedStatementValues); ReceivingModeTypeRowMapper receivingModeRowMapper = new ReceivingModeTypeRowMapper(); jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), receivingModeRowMapper); Map<String, ReceivingModeType> modeMap = receivingModeRowMapper.modeMap; Iterator<Entry<String, ReceivingModeType>> itr = modeMap.entrySet().iterator(); List<ReceivingModeType> receivingModeList = new ArrayList<>(); while (itr.hasNext()) { Entry<String, ReceivingModeType> itrEntry = itr.next(); receivingModeList.add(itrEntry.getValue()); } return receivingModeList; }  ReceivingModeTypeReq persistReceivingModeType(final ReceivingModeTypeReq modeTypeRequest); ReceivingModeTypeReq persistModifyReceivingModeType(final ReceivingModeTypeReq modeTypeRequest); List<ReceivingModeType> getAllReceivingModeTypes(final ReceivingModeTypeGetReq modeTypeGetRequest); boolean checkReceivingModeTypeByNameAndCode(final String code, final String name, final String tenantId, final String mode); boolean checkReceivingModeTypeByName(final String code, final String name, final String tenantId, final String mode); boolean checkReceivingModeTypeByCode(final String code, final String tenantId, final String mode); }
ReceivingModeTypeRepository { public List<ReceivingModeType> getAllReceivingModeTypes(final ReceivingModeTypeGetReq modeTypeGetRequest) { LOGGER.info("ReceivingModeType search Request::" + modeTypeGetRequest); final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = receivingModeTypeQueryBuilder.getQuery(modeTypeGetRequest, preparedStatementValues); ReceivingModeTypeRowMapper receivingModeRowMapper = new ReceivingModeTypeRowMapper(); jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), receivingModeRowMapper); Map<String, ReceivingModeType> modeMap = receivingModeRowMapper.modeMap; Iterator<Entry<String, ReceivingModeType>> itr = modeMap.entrySet().iterator(); List<ReceivingModeType> receivingModeList = new ArrayList<>(); while (itr.hasNext()) { Entry<String, ReceivingModeType> itrEntry = itr.next(); receivingModeList.add(itrEntry.getValue()); } return receivingModeList; }  ReceivingModeTypeReq persistReceivingModeType(final ReceivingModeTypeReq modeTypeRequest); ReceivingModeTypeReq persistModifyReceivingModeType(final ReceivingModeTypeReq modeTypeRequest); List<ReceivingModeType> getAllReceivingModeTypes(final ReceivingModeTypeGetReq modeTypeGetRequest); boolean checkReceivingModeTypeByNameAndCode(final String code, final String name, final String tenantId, final String mode); boolean checkReceivingModeTypeByName(final String code, final String name, final String tenantId, final String mode); boolean checkReceivingModeTypeByCode(final String code, final String tenantId, final String mode); static final Logger LOGGER; }