@SuppressWarnings("unchecked") @Test public void testGetNextId() { final Long expectedId = Long.valueOf("6"); when(jdbcTemplate.queryForObject(any(String.class), any(Class.class))).thenReturn(6); final Long actualId = assetCommonService.getNextId(Sequence.ASSETCATEGORYSEQUENCE); assertEquals(expectedId, actualId); }
public Long getNextId(final Sequence sequence) { final String query = "SELECT nextval('" + sequence.toString() + "')"; Integer result = null; try { result = jdbcTemplate.queryForObject(query, Integer.class); log.debug("result:" + result); return result.longValue(); } catch (final Exception ex) { throw new RuntimeException("Next id is not generated."); } }
AssetCommonService { public Long getNextId(final Sequence sequence) { final String query = "SELECT nextval('" + sequence.toString() + "')"; Integer result = null; try { result = jdbcTemplate.queryForObject(query, Integer.class); log.debug("result:" + result); return result.longValue(); } catch (final Exception ex) { throw new RuntimeException("Next id is not generated."); } } }
AssetCommonService { public Long getNextId(final Sequence sequence) { final String query = "SELECT nextval('" + sequence.toString() + "')"; Integer result = null; try { result = jdbcTemplate.queryForObject(query, Integer.class); log.debug("result:" + result); return result.longValue(); } catch (final Exception ex) { throw new RuntimeException("Next id is not generated."); } }  }
AssetCommonService { public Long getNextId(final Sequence sequence) { final String query = "SELECT nextval('" + sequence.toString() + "')"; Integer result = null; try { result = jdbcTemplate.queryForObject(query, Integer.class); log.debug("result:" + result); return result.longValue(); } catch (final Exception ex) { throw new RuntimeException("Next id is not generated."); } }  ErrorResponse populateErrors(final BindingResult errors); Double getDepreciationRate(final Double depreciationRate); void validateDepreciationRateValue(final Double depreciationRate); AuditDetails getAuditDetails(final RequestInfo requestInfo); String getCode(final String codeFormat, final Sequence sequence); Long getNextId(final Sequence sequence); }
AssetCommonService { public Long getNextId(final Sequence sequence) { final String query = "SELECT nextval('" + sequence.toString() + "')"; Integer result = null; try { result = jdbcTemplate.queryForObject(query, Integer.class); log.debug("result:" + result); return result.longValue(); } catch (final Exception ex) { throw new RuntimeException("Next id is not generated."); } }  ErrorResponse populateErrors(final BindingResult errors); Double getDepreciationRate(final Double depreciationRate); void validateDepreciationRateValue(final Double depreciationRate); AuditDetails getAuditDetails(final RequestInfo requestInfo); String getCode(final String codeFormat, final Sequence sequence); Long getNextId(final Sequence sequence);  }