@Test public void createNoticeTest(){ Notice notice = new Notice(); notice.setNoticeNo("0000000001"); NoticeRequest noticeRequest = new NoticeRequest(); noticeRequest.setNotice(notice); RequestInfo info = new RequestInfo(); noticeRequest.setRequestInfo(info); Object[] obj = new Object[]{}; when(jdbcTemplate.update("insert",obj)).thenReturn(1); when(jdbcTemplate.queryForObject("next val",Integer.class)).thenReturn(1); assertTrue(notice.equals(noticeRepository.createNotice(noticeRequest))); }
public Notice createNotice(NoticeRequest noticeRequest) { RequestInfo requestInfo = noticeRequest.getRequestInfo(); Notice notice = noticeRequest.getNotice(); Object[] obj = new Object[] { notice.getNoticeNo(), notice.getNoticeDate(), notice.getAgreementNumber(), notice.getAssetCategory(), notice.getAcknowledgementNumber(), notice.getAssetNo(), notice.getAllotteeName(), notice.getAllotteeAddress(), notice.getAllotteeMobileNumber(), notice.getAgreementPeriod(), notice.getCommencementDate(), notice.getTemplateVersion(), notice.getExpiryDate(), notice.getRent(), notice.getSecurityDeposit(), notice.getCommissionerName(), notice.getZone(), notice.getWard(), notice.getStreet(), notice.getElectionward(), notice.getLocality(), notice.getBlock(), requestInfo.getRequesterId(), new Date(), requestInfo.getRequesterId(), new Date(), notice.getTenantId(), notice.getFileStore(), notice.getNoticeType() }; try { jdbcTemplate.update(NoticeQueryBuilder.INSERT_NOTICE_QUERY, obj); } catch (Exception ex) { LOGGER.info("the exception from notice repo query :: " + ex); throw new RuntimeException(ex.getMessage()); } return notice; }
NoticeRepository { public Notice createNotice(NoticeRequest noticeRequest) { RequestInfo requestInfo = noticeRequest.getRequestInfo(); Notice notice = noticeRequest.getNotice(); Object[] obj = new Object[] { notice.getNoticeNo(), notice.getNoticeDate(), notice.getAgreementNumber(), notice.getAssetCategory(), notice.getAcknowledgementNumber(), notice.getAssetNo(), notice.getAllotteeName(), notice.getAllotteeAddress(), notice.getAllotteeMobileNumber(), notice.getAgreementPeriod(), notice.getCommencementDate(), notice.getTemplateVersion(), notice.getExpiryDate(), notice.getRent(), notice.getSecurityDeposit(), notice.getCommissionerName(), notice.getZone(), notice.getWard(), notice.getStreet(), notice.getElectionward(), notice.getLocality(), notice.getBlock(), requestInfo.getRequesterId(), new Date(), requestInfo.getRequesterId(), new Date(), notice.getTenantId(), notice.getFileStore(), notice.getNoticeType() }; try { jdbcTemplate.update(NoticeQueryBuilder.INSERT_NOTICE_QUERY, obj); } catch (Exception ex) { LOGGER.info("the exception from notice repo query :: " + ex); throw new RuntimeException(ex.getMessage()); } return notice; } }
NoticeRepository { public Notice createNotice(NoticeRequest noticeRequest) { RequestInfo requestInfo = noticeRequest.getRequestInfo(); Notice notice = noticeRequest.getNotice(); Object[] obj = new Object[] { notice.getNoticeNo(), notice.getNoticeDate(), notice.getAgreementNumber(), notice.getAssetCategory(), notice.getAcknowledgementNumber(), notice.getAssetNo(), notice.getAllotteeName(), notice.getAllotteeAddress(), notice.getAllotteeMobileNumber(), notice.getAgreementPeriod(), notice.getCommencementDate(), notice.getTemplateVersion(), notice.getExpiryDate(), notice.getRent(), notice.getSecurityDeposit(), notice.getCommissionerName(), notice.getZone(), notice.getWard(), notice.getStreet(), notice.getElectionward(), notice.getLocality(), notice.getBlock(), requestInfo.getRequesterId(), new Date(), requestInfo.getRequesterId(), new Date(), notice.getTenantId(), notice.getFileStore(), notice.getNoticeType() }; try { jdbcTemplate.update(NoticeQueryBuilder.INSERT_NOTICE_QUERY, obj); } catch (Exception ex) { LOGGER.info("the exception from notice repo query :: " + ex); throw new RuntimeException(ex.getMessage()); } return notice; }  }
NoticeRepository { public Notice createNotice(NoticeRequest noticeRequest) { RequestInfo requestInfo = noticeRequest.getRequestInfo(); Notice notice = noticeRequest.getNotice(); Object[] obj = new Object[] { notice.getNoticeNo(), notice.getNoticeDate(), notice.getAgreementNumber(), notice.getAssetCategory(), notice.getAcknowledgementNumber(), notice.getAssetNo(), notice.getAllotteeName(), notice.getAllotteeAddress(), notice.getAllotteeMobileNumber(), notice.getAgreementPeriod(), notice.getCommencementDate(), notice.getTemplateVersion(), notice.getExpiryDate(), notice.getRent(), notice.getSecurityDeposit(), notice.getCommissionerName(), notice.getZone(), notice.getWard(), notice.getStreet(), notice.getElectionward(), notice.getLocality(), notice.getBlock(), requestInfo.getRequesterId(), new Date(), requestInfo.getRequesterId(), new Date(), notice.getTenantId(), notice.getFileStore(), notice.getNoticeType() }; try { jdbcTemplate.update(NoticeQueryBuilder.INSERT_NOTICE_QUERY, obj); } catch (Exception ex) { LOGGER.info("the exception from notice repo query :: " + ex); throw new RuntimeException(ex.getMessage()); } return notice; }  Notice createNotice(NoticeRequest noticeRequest); DueNotice createDueNotice(DueNoticeRequest noticeRequest); List<DueNotice> getAllDueNoticesByAgreement(DueNoticeCriteria noticeCriteria); Set<DefaultersInfo> generateDueNoticeData(DueSearchCriteria dueCriteria); List<Notice> getNotices(NoticeCriteria noticeCriteria); List<DefaultersInfo> getDefaulterDetails(DueNotice noticeData); }
NoticeRepository { public Notice createNotice(NoticeRequest noticeRequest) { RequestInfo requestInfo = noticeRequest.getRequestInfo(); Notice notice = noticeRequest.getNotice(); Object[] obj = new Object[] { notice.getNoticeNo(), notice.getNoticeDate(), notice.getAgreementNumber(), notice.getAssetCategory(), notice.getAcknowledgementNumber(), notice.getAssetNo(), notice.getAllotteeName(), notice.getAllotteeAddress(), notice.getAllotteeMobileNumber(), notice.getAgreementPeriod(), notice.getCommencementDate(), notice.getTemplateVersion(), notice.getExpiryDate(), notice.getRent(), notice.getSecurityDeposit(), notice.getCommissionerName(), notice.getZone(), notice.getWard(), notice.getStreet(), notice.getElectionward(), notice.getLocality(), notice.getBlock(), requestInfo.getRequesterId(), new Date(), requestInfo.getRequesterId(), new Date(), notice.getTenantId(), notice.getFileStore(), notice.getNoticeType() }; try { jdbcTemplate.update(NoticeQueryBuilder.INSERT_NOTICE_QUERY, obj); } catch (Exception ex) { LOGGER.info("the exception from notice repo query :: " + ex); throw new RuntimeException(ex.getMessage()); } return notice; }  Notice createNotice(NoticeRequest noticeRequest); DueNotice createDueNotice(DueNoticeRequest noticeRequest); List<DueNotice> getAllDueNoticesByAgreement(DueNoticeCriteria noticeCriteria); Set<DefaultersInfo> generateDueNoticeData(DueSearchCriteria dueCriteria); List<Notice> getNotices(NoticeCriteria noticeCriteria); List<DefaultersInfo> getDefaulterDetails(DueNotice noticeData); static final Logger LOGGER; }