@SuppressWarnings("unchecked") @Test public void testGetDepreciatedAssets() { final List<DepreciationReportCriteria> depreciationReport = new ArrayList<>(); depreciationReport.add(getAssetDepreciationReport()); when(depreciationReportQueryBuilder.getQuery(any(DepreciationReportCriteria.class), any(List.class))) .thenReturn(StringUtils.EMPTY); when(jdbcTemplate.query(any(String.class), any(Object[].class), any(DepreciationReportRowMapper.class))) .thenReturn(depreciationReport); final DepreciationReportCriteria depreciationReportCriteria = DepreciationReportCriteria.builder() .assetCategoryName("category name") .tenantId("ap.kurnool").build(); final List<DepreciationReportCriteria> actualAssets = depreciationRepository .getDepreciatedAsset(depreciationReportCriteria); assertEquals(depreciationReport, actualAssets); }
public List<DepreciationReportCriteria> getDepreciatedAsset(final DepreciationReportCriteria depreciationReportCriteria) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = depreciationReportQueryBuilder.getQuery(depreciationReportCriteria, preparedStatementValues); List<DepreciationReportCriteria> depreciations = new ArrayList<>(); try { log.debug("queryStr::" + queryStr + "preparedStatementValues::" + preparedStatementValues.toString()); depreciations = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), depreciationReportRowMapper); log.debug("DepreciationRepository::" + depreciationReportCriteria); } catch (final Exception ex) { log.debug("the exception from findforcriteria : " + ex); throw new RuntimeException("the exception from find for depreciated asset criteria"); } return depreciations; }
DepreciationRepository { public List<DepreciationReportCriteria> getDepreciatedAsset(final DepreciationReportCriteria depreciationReportCriteria) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = depreciationReportQueryBuilder.getQuery(depreciationReportCriteria, preparedStatementValues); List<DepreciationReportCriteria> depreciations = new ArrayList<>(); try { log.debug("queryStr::" + queryStr + "preparedStatementValues::" + preparedStatementValues.toString()); depreciations = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), depreciationReportRowMapper); log.debug("DepreciationRepository::" + depreciationReportCriteria); } catch (final Exception ex) { log.debug("the exception from findforcriteria : " + ex); throw new RuntimeException("the exception from find for depreciated asset criteria"); } return depreciations; } }
DepreciationRepository { public List<DepreciationReportCriteria> getDepreciatedAsset(final DepreciationReportCriteria depreciationReportCriteria) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = depreciationReportQueryBuilder.getQuery(depreciationReportCriteria, preparedStatementValues); List<DepreciationReportCriteria> depreciations = new ArrayList<>(); try { log.debug("queryStr::" + queryStr + "preparedStatementValues::" + preparedStatementValues.toString()); depreciations = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), depreciationReportRowMapper); log.debug("DepreciationRepository::" + depreciationReportCriteria); } catch (final Exception ex) { log.debug("the exception from findforcriteria : " + ex); throw new RuntimeException("the exception from find for depreciated asset criteria"); } return depreciations; }  }
DepreciationRepository { public List<DepreciationReportCriteria> getDepreciatedAsset(final DepreciationReportCriteria depreciationReportCriteria) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = depreciationReportQueryBuilder.getQuery(depreciationReportCriteria, preparedStatementValues); List<DepreciationReportCriteria> depreciations = new ArrayList<>(); try { log.debug("queryStr::" + queryStr + "preparedStatementValues::" + preparedStatementValues.toString()); depreciations = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), depreciationReportRowMapper); log.debug("DepreciationRepository::" + depreciationReportCriteria); } catch (final Exception ex) { log.debug("the exception from findforcriteria : " + ex); throw new RuntimeException("the exception from find for depreciated asset criteria"); } return depreciations; }  List<DepreciationDetail> getDepreciationdetails(final DepreciationCriteria depreciationCriteria); void persistDepreciation(final Depreciation depreciation); Map<Long, BigDecimal> getdepreciationSum(final String tenantId); List<CalculationAssetDetails> getCalculationAssetDetails(final DepreciationCriteria depreciationCriteria); List<CalculationCurrentValue> getCalculationCurrentvalue(final DepreciationCriteria depreciationCriteria); List<DepreciationReportCriteria> getDepreciatedAsset(final DepreciationReportCriteria depreciationReportCriteria); List<DepreciationInputs> getDepreciationInputs(final DepreciationCriteria depreciationCriteria); }
DepreciationRepository { public List<DepreciationReportCriteria> getDepreciatedAsset(final DepreciationReportCriteria depreciationReportCriteria) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = depreciationReportQueryBuilder.getQuery(depreciationReportCriteria, preparedStatementValues); List<DepreciationReportCriteria> depreciations = new ArrayList<>(); try { log.debug("queryStr::" + queryStr + "preparedStatementValues::" + preparedStatementValues.toString()); depreciations = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), depreciationReportRowMapper); log.debug("DepreciationRepository::" + depreciationReportCriteria); } catch (final Exception ex) { log.debug("the exception from findforcriteria : " + ex); throw new RuntimeException("the exception from find for depreciated asset criteria"); } return depreciations; }  List<DepreciationDetail> getDepreciationdetails(final DepreciationCriteria depreciationCriteria); void persistDepreciation(final Depreciation depreciation); Map<Long, BigDecimal> getdepreciationSum(final String tenantId); List<CalculationAssetDetails> getCalculationAssetDetails(final DepreciationCriteria depreciationCriteria); List<CalculationCurrentValue> getCalculationCurrentvalue(final DepreciationCriteria depreciationCriteria); List<DepreciationReportCriteria> getDepreciatedAsset(final DepreciationReportCriteria depreciationReportCriteria); List<DepreciationInputs> getDepreciationInputs(final DepreciationCriteria depreciationCriteria);  }