@Test public void testGetIds() { List<Long> ids = new ArrayList<>(); ids.add(Long.valueOf("2")); ids.add(Long.valueOf("6")); when(jdbcTemplate.queryForList(any(String.class), Matchers.<Class<Long>>any())).thenReturn(ids); List<Long> idList = marriageDocumentTypeRepository.getIds(getMarriageDocumentTypes()); assertTrue(idList.equals(ids)); }
public List<Long> getIds(List<MarriageDocumentType> marriageDocumentTypeList) { log.debug("Differentiating Update And Create Records in getIds:: MarriageDocumentTypeRepository"); StringBuilder idQuery = new StringBuilder("(" + marriageDocumentTypeList.get(0).getId()); for (int index = 1; index < marriageDocumentTypeList.size(); index++) { idQuery.append("," + marriageDocumentTypeList.get(index).getId()); } idQuery.append(")"); List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM egmr_marriage_document_type WHERE id IN " + idQuery, Long.class); return ids; }
MarriageDocumentTypeRepository { public List<Long> getIds(List<MarriageDocumentType> marriageDocumentTypeList) { log.debug("Differentiating Update And Create Records in getIds:: MarriageDocumentTypeRepository"); StringBuilder idQuery = new StringBuilder("(" + marriageDocumentTypeList.get(0).getId()); for (int index = 1; index < marriageDocumentTypeList.size(); index++) { idQuery.append("," + marriageDocumentTypeList.get(index).getId()); } idQuery.append(")"); List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM egmr_marriage_document_type WHERE id IN " + idQuery, Long.class); return ids; } }
MarriageDocumentTypeRepository { public List<Long> getIds(List<MarriageDocumentType> marriageDocumentTypeList) { log.debug("Differentiating Update And Create Records in getIds:: MarriageDocumentTypeRepository"); StringBuilder idQuery = new StringBuilder("(" + marriageDocumentTypeList.get(0).getId()); for (int index = 1; index < marriageDocumentTypeList.size(); index++) { idQuery.append("," + marriageDocumentTypeList.get(index).getId()); } idQuery.append(")"); List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM egmr_marriage_document_type WHERE id IN " + idQuery, Long.class); return ids; }  }
MarriageDocumentTypeRepository { public List<Long> getIds(List<MarriageDocumentType> marriageDocumentTypeList) { log.debug("Differentiating Update And Create Records in getIds:: MarriageDocumentTypeRepository"); StringBuilder idQuery = new StringBuilder("(" + marriageDocumentTypeList.get(0).getId()); for (int index = 1; index < marriageDocumentTypeList.size(); index++) { idQuery.append("," + marriageDocumentTypeList.get(index).getId()); } idQuery.append(")"); List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM egmr_marriage_document_type WHERE id IN " + idQuery, Long.class); return ids; }  List<MarriageDocumentType> search(MarriageDocumentTypeSearchCriteria marriageDocumentTypeSearchCriteria); void create(List<MarriageDocumentType> marriageDocumentTypes); void update(List<MarriageDocumentType> marriageDocumentTypes); List<Long> getIds(List<MarriageDocumentType> marriageDocumentTypeList); }
MarriageDocumentTypeRepository { public List<Long> getIds(List<MarriageDocumentType> marriageDocumentTypeList) { log.debug("Differentiating Update And Create Records in getIds:: MarriageDocumentTypeRepository"); StringBuilder idQuery = new StringBuilder("(" + marriageDocumentTypeList.get(0).getId()); for (int index = 1; index < marriageDocumentTypeList.size(); index++) { idQuery.append("," + marriageDocumentTypeList.get(index).getId()); } idQuery.append(")"); List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM egmr_marriage_document_type WHERE id IN " + idQuery, Long.class); return ids; }  List<MarriageDocumentType> search(MarriageDocumentTypeSearchCriteria marriageDocumentTypeSearchCriteria); void create(List<MarriageDocumentType> marriageDocumentTypes); void update(List<MarriageDocumentType> marriageDocumentTypes); List<Long> getIds(List<MarriageDocumentType> marriageDocumentTypeList);  }