@Test public void testCreateRevaluation() { final RequestInfo requestInfo = new RequestInfo(); final User user = new User(); user.setId(1l); requestInfo.setUserInfo(user); final Revaluation revaluation = getRevaluationFromDB(); final RevaluationRequest revaluationRequest = new RevaluationRequest(); revaluationRequest.setRequestInfo(requestInfo); revaluationRequest.setRevaluation(revaluation); final List<AssetStatus> assetStatuses = new ArrayList<>(); final AssetStatus assetStatus = getRevaluationApprovedStatus(); assetStatuses.add(assetStatus); when(jdbcTemplate.update(any(String.class), any(Object[].class))).thenReturn(1); when(assetMasterService.getStatuses(any(AssetStatusObjectName.class), any(Status.class), any(String.class))) .thenReturn(assetStatuses); revaluationRepository.create(revaluationRequest); }
public void create(final RevaluationRequest revaluationRequest) { log.info("RevaluationRepository create revaluationRequest:" + revaluationRequest); final Revaluation revaluation = revaluationRequest.getRevaluation(); final RequestInfo requestInfo = revaluationRequest.getRequestInfo(); final String sql = RevaluationQueryBuilder.INSERT_QUERY; final String status = getRevaluationStatus(AssetStatusObjectName.REVALUATION, Status.APPROVED, revaluation.getTenantId()); final Object[] obj = new Object[] { revaluation.getId(), revaluation.getTenantId(), revaluation.getAssetId(), revaluation.getCurrentCapitalizedValue(), revaluation.getTypeOfChange().toString(), revaluation.getRevaluationAmount(), revaluation.getValueAfterRevaluation(), revaluation.getRevaluationDate(), requestInfo.getUserInfo().getId().toString(), revaluation.getReasonForRevaluation(), revaluation.getFixedAssetsWrittenOffAccount(), revaluation.getFunction(), revaluation.getFund(), revaluation.getComments(), status, requestInfo.getUserInfo().getId(), new Date().getTime(), requestInfo.getUserInfo().getId(), new Date().getTime(), revaluation.getVoucherReference(), revaluation.getRevaluationOrderNo(), revaluation.getRevaluationOrderDate() }; try { jdbcTemplate.update(sql, obj); } catch (final Exception ex) { log.info("RevaluationRepository create:" + ex.getMessage()); throw new RuntimeException("exceptions occured while persisting the revaluation :" + ex.getMessage()); } }
RevaluationRepository { public void create(final RevaluationRequest revaluationRequest) { log.info("RevaluationRepository create revaluationRequest:" + revaluationRequest); final Revaluation revaluation = revaluationRequest.getRevaluation(); final RequestInfo requestInfo = revaluationRequest.getRequestInfo(); final String sql = RevaluationQueryBuilder.INSERT_QUERY; final String status = getRevaluationStatus(AssetStatusObjectName.REVALUATION, Status.APPROVED, revaluation.getTenantId()); final Object[] obj = new Object[] { revaluation.getId(), revaluation.getTenantId(), revaluation.getAssetId(), revaluation.getCurrentCapitalizedValue(), revaluation.getTypeOfChange().toString(), revaluation.getRevaluationAmount(), revaluation.getValueAfterRevaluation(), revaluation.getRevaluationDate(), requestInfo.getUserInfo().getId().toString(), revaluation.getReasonForRevaluation(), revaluation.getFixedAssetsWrittenOffAccount(), revaluation.getFunction(), revaluation.getFund(), revaluation.getComments(), status, requestInfo.getUserInfo().getId(), new Date().getTime(), requestInfo.getUserInfo().getId(), new Date().getTime(), revaluation.getVoucherReference(), revaluation.getRevaluationOrderNo(), revaluation.getRevaluationOrderDate() }; try { jdbcTemplate.update(sql, obj); } catch (final Exception ex) { log.info("RevaluationRepository create:" + ex.getMessage()); throw new RuntimeException("exceptions occured while persisting the revaluation :" + ex.getMessage()); } } }
RevaluationRepository { public void create(final RevaluationRequest revaluationRequest) { log.info("RevaluationRepository create revaluationRequest:" + revaluationRequest); final Revaluation revaluation = revaluationRequest.getRevaluation(); final RequestInfo requestInfo = revaluationRequest.getRequestInfo(); final String sql = RevaluationQueryBuilder.INSERT_QUERY; final String status = getRevaluationStatus(AssetStatusObjectName.REVALUATION, Status.APPROVED, revaluation.getTenantId()); final Object[] obj = new Object[] { revaluation.getId(), revaluation.getTenantId(), revaluation.getAssetId(), revaluation.getCurrentCapitalizedValue(), revaluation.getTypeOfChange().toString(), revaluation.getRevaluationAmount(), revaluation.getValueAfterRevaluation(), revaluation.getRevaluationDate(), requestInfo.getUserInfo().getId().toString(), revaluation.getReasonForRevaluation(), revaluation.getFixedAssetsWrittenOffAccount(), revaluation.getFunction(), revaluation.getFund(), revaluation.getComments(), status, requestInfo.getUserInfo().getId(), new Date().getTime(), requestInfo.getUserInfo().getId(), new Date().getTime(), revaluation.getVoucherReference(), revaluation.getRevaluationOrderNo(), revaluation.getRevaluationOrderDate() }; try { jdbcTemplate.update(sql, obj); } catch (final Exception ex) { log.info("RevaluationRepository create:" + ex.getMessage()); throw new RuntimeException("exceptions occured while persisting the revaluation :" + ex.getMessage()); } }  }
RevaluationRepository { public void create(final RevaluationRequest revaluationRequest) { log.info("RevaluationRepository create revaluationRequest:" + revaluationRequest); final Revaluation revaluation = revaluationRequest.getRevaluation(); final RequestInfo requestInfo = revaluationRequest.getRequestInfo(); final String sql = RevaluationQueryBuilder.INSERT_QUERY; final String status = getRevaluationStatus(AssetStatusObjectName.REVALUATION, Status.APPROVED, revaluation.getTenantId()); final Object[] obj = new Object[] { revaluation.getId(), revaluation.getTenantId(), revaluation.getAssetId(), revaluation.getCurrentCapitalizedValue(), revaluation.getTypeOfChange().toString(), revaluation.getRevaluationAmount(), revaluation.getValueAfterRevaluation(), revaluation.getRevaluationDate(), requestInfo.getUserInfo().getId().toString(), revaluation.getReasonForRevaluation(), revaluation.getFixedAssetsWrittenOffAccount(), revaluation.getFunction(), revaluation.getFund(), revaluation.getComments(), status, requestInfo.getUserInfo().getId(), new Date().getTime(), requestInfo.getUserInfo().getId(), new Date().getTime(), revaluation.getVoucherReference(), revaluation.getRevaluationOrderNo(), revaluation.getRevaluationOrderDate() }; try { jdbcTemplate.update(sql, obj); } catch (final Exception ex) { log.info("RevaluationRepository create:" + ex.getMessage()); throw new RuntimeException("exceptions occured while persisting the revaluation :" + ex.getMessage()); } }  void create(final RevaluationRequest revaluationRequest); String getRevaluationStatus(final AssetStatusObjectName objectName, final Status code,
            final String tenantId); List<Revaluation> search(final RevaluationCriteria revaluationCriteria); }
RevaluationRepository { public void create(final RevaluationRequest revaluationRequest) { log.info("RevaluationRepository create revaluationRequest:" + revaluationRequest); final Revaluation revaluation = revaluationRequest.getRevaluation(); final RequestInfo requestInfo = revaluationRequest.getRequestInfo(); final String sql = RevaluationQueryBuilder.INSERT_QUERY; final String status = getRevaluationStatus(AssetStatusObjectName.REVALUATION, Status.APPROVED, revaluation.getTenantId()); final Object[] obj = new Object[] { revaluation.getId(), revaluation.getTenantId(), revaluation.getAssetId(), revaluation.getCurrentCapitalizedValue(), revaluation.getTypeOfChange().toString(), revaluation.getRevaluationAmount(), revaluation.getValueAfterRevaluation(), revaluation.getRevaluationDate(), requestInfo.getUserInfo().getId().toString(), revaluation.getReasonForRevaluation(), revaluation.getFixedAssetsWrittenOffAccount(), revaluation.getFunction(), revaluation.getFund(), revaluation.getComments(), status, requestInfo.getUserInfo().getId(), new Date().getTime(), requestInfo.getUserInfo().getId(), new Date().getTime(), revaluation.getVoucherReference(), revaluation.getRevaluationOrderNo(), revaluation.getRevaluationOrderDate() }; try { jdbcTemplate.update(sql, obj); } catch (final Exception ex) { log.info("RevaluationRepository create:" + ex.getMessage()); throw new RuntimeException("exceptions occured while persisting the revaluation :" + ex.getMessage()); } }  void create(final RevaluationRequest revaluationRequest); String getRevaluationStatus(final AssetStatusObjectName objectName, final Status code,
            final String tenantId); List<Revaluation> search(final RevaluationCriteria revaluationCriteria);  }