@Test public void testGetIds() { List<String> ids = new ArrayList<>(); ids.add("2"); ids.add("6"); when(jdbcTemplate.queryForList(any(String.class), Matchers.<Object[]>any(), Matchers.<Class<String>>any())) .thenReturn(ids); assertEquals(sequenceIdGenService.getIds(1, "seq_name"), ids); }
public List<String> getIds(int rsSize, String seqName) { String query = "SELECT NEXTVAL('" + seqName + "') FROM GENERATE_SERIES(1,?)"; List<String> ids = null; try { ids = jdbcTemplate.queryForList(query, new Object[] { rsSize }, String.class); log.debug("Generated Ids:: " + ids + " for Sequence: " + seqName); } catch (Exception e) { e.printStackTrace(); } return ids; }
SequenceIdGenService { public List<String> getIds(int rsSize, String seqName) { String query = "SELECT NEXTVAL('" + seqName + "') FROM GENERATE_SERIES(1,?)"; List<String> ids = null; try { ids = jdbcTemplate.queryForList(query, new Object[] { rsSize }, String.class); log.debug("Generated Ids:: " + ids + " for Sequence: " + seqName); } catch (Exception e) { e.printStackTrace(); } return ids; } }
SequenceIdGenService { public List<String> getIds(int rsSize, String seqName) { String query = "SELECT NEXTVAL('" + seqName + "') FROM GENERATE_SERIES(1,?)"; List<String> ids = null; try { ids = jdbcTemplate.queryForList(query, new Object[] { rsSize }, String.class); log.debug("Generated Ids:: " + ids + " for Sequence: " + seqName); } catch (Exception e) { e.printStackTrace(); } return ids; }  }
SequenceIdGenService { public List<String> getIds(int rsSize, String seqName) { String query = "SELECT NEXTVAL('" + seqName + "') FROM GENERATE_SERIES(1,?)"; List<String> ids = null; try { ids = jdbcTemplate.queryForList(query, new Object[] { rsSize }, String.class); log.debug("Generated Ids:: " + ids + " for Sequence: " + seqName); } catch (Exception e) { e.printStackTrace(); } return ids; }  List<Long> idSeqGen(int rsSize, String seqName); List<Long> codeSeqGen(int rsSize, String seqName); List<String> getIds(int rsSize, String seqName); }
SequenceIdGenService { public List<String> getIds(int rsSize, String seqName) { String query = "SELECT NEXTVAL('" + seqName + "') FROM GENERATE_SERIES(1,?)"; List<String> ids = null; try { ids = jdbcTemplate.queryForList(query, new Object[] { rsSize }, String.class); log.debug("Generated Ids:: " + ids + " for Sequence: " + seqName); } catch (Exception e) { e.printStackTrace(); } return ids; }  List<Long> idSeqGen(int rsSize, String seqName); List<Long> codeSeqGen(int rsSize, String seqName); List<String> getIds(int rsSize, String seqName);  }