@Test public void testForcreateAsync() { org.egov.common.contract.response.ResponseInfo responseInfo = org.egov.common.contract.response.ResponseInfo .builder().apiId("uief87324").resMsgId("String").status("200").ts(Long.valueOf("987456321")) .ver("string").build(); ReissueCertResponse reissueCertResp = ReissueCertResponse.builder() .reissueApplications(getReissueCertApplFromDB()).responseInfo(null).page(null).build(); System.err.println("reissueCertResp" + reissueCertResp); ReissueCertRequest reissueRequest = ReissueCertRequest.builder() .reissueApplication(reissueCertResp.getReissueApplications().get(0)).requestInfo(new RequestInfo()) .build(); List<String> ids = new ArrayList<>(); ids.add("1"); when(sequenceGenUtil.getIds(Matchers.any(int.class), Matchers.any(String.class))).thenReturn(ids); when(kafkaTemplate.send(Matchers.any(String.class), Matchers.any(String.class), Matchers.any(Object.class))) .thenReturn(new SendResult<>(null, null)); System.err.println( "marriageCertService.createAsync(reissueRequest)" + marriageCertService.createAsync(reissueRequest)); assertTrue(reissueCertResp.equals(marriageCertService.createAsync(reissueRequest))); }
public ReissueCertResponse createAsync(ReissueCertRequest reissueCertRequest) { List<MarriageDocument> marriageDocuments = reissueCertRequest.getReissueApplication().getDocuments(); ReissueCertAppl reIssueApp = reissueCertRequest.getReissueApplication(); List<ReissueCertAppl> reissueCertAppl = new ArrayList<ReissueCertAppl>(); int docsSize = marriageDocuments.size(); List<String> docIds = sequenceGenUtil.getIds(docsSize, "egmr_documents_id"); reIssueApp.setId(sequenceGenUtil.getIds(1, reisuueIdSeq).get(0)); int index = 0; for (MarriageDocument docs : marriageDocuments) { docs.setId(docIds.get(index++)); docs.setReissueCertificateId(reIssueApp.getId()); } try { kafkaTemplate.send(propertiesManager.getCreateReissueMarriageRegnTopicName(), propertiesManager.getCreateReissueMarriageRegnKey(), reissueCertRequest); } catch (Exception e) { e.printStackTrace(); } reissueCertAppl.add(reIssueApp); return getMarriageCertResponse(reissueCertAppl, reissueCertRequest.getRequestInfo()); }
MarriageCertService { public ReissueCertResponse createAsync(ReissueCertRequest reissueCertRequest) { List<MarriageDocument> marriageDocuments = reissueCertRequest.getReissueApplication().getDocuments(); ReissueCertAppl reIssueApp = reissueCertRequest.getReissueApplication(); List<ReissueCertAppl> reissueCertAppl = new ArrayList<ReissueCertAppl>(); int docsSize = marriageDocuments.size(); List<String> docIds = sequenceGenUtil.getIds(docsSize, "egmr_documents_id"); reIssueApp.setId(sequenceGenUtil.getIds(1, reisuueIdSeq).get(0)); int index = 0; for (MarriageDocument docs : marriageDocuments) { docs.setId(docIds.get(index++)); docs.setReissueCertificateId(reIssueApp.getId()); } try { kafkaTemplate.send(propertiesManager.getCreateReissueMarriageRegnTopicName(), propertiesManager.getCreateReissueMarriageRegnKey(), reissueCertRequest); } catch (Exception e) { e.printStackTrace(); } reissueCertAppl.add(reIssueApp); return getMarriageCertResponse(reissueCertAppl, reissueCertRequest.getRequestInfo()); } }
MarriageCertService { public ReissueCertResponse createAsync(ReissueCertRequest reissueCertRequest) { List<MarriageDocument> marriageDocuments = reissueCertRequest.getReissueApplication().getDocuments(); ReissueCertAppl reIssueApp = reissueCertRequest.getReissueApplication(); List<ReissueCertAppl> reissueCertAppl = new ArrayList<ReissueCertAppl>(); int docsSize = marriageDocuments.size(); List<String> docIds = sequenceGenUtil.getIds(docsSize, "egmr_documents_id"); reIssueApp.setId(sequenceGenUtil.getIds(1, reisuueIdSeq).get(0)); int index = 0; for (MarriageDocument docs : marriageDocuments) { docs.setId(docIds.get(index++)); docs.setReissueCertificateId(reIssueApp.getId()); } try { kafkaTemplate.send(propertiesManager.getCreateReissueMarriageRegnTopicName(), propertiesManager.getCreateReissueMarriageRegnKey(), reissueCertRequest); } catch (Exception e) { e.printStackTrace(); } reissueCertAppl.add(reIssueApp); return getMarriageCertResponse(reissueCertAppl, reissueCertRequest.getRequestInfo()); }  }
MarriageCertService { public ReissueCertResponse createAsync(ReissueCertRequest reissueCertRequest) { List<MarriageDocument> marriageDocuments = reissueCertRequest.getReissueApplication().getDocuments(); ReissueCertAppl reIssueApp = reissueCertRequest.getReissueApplication(); List<ReissueCertAppl> reissueCertAppl = new ArrayList<ReissueCertAppl>(); int docsSize = marriageDocuments.size(); List<String> docIds = sequenceGenUtil.getIds(docsSize, "egmr_documents_id"); reIssueApp.setId(sequenceGenUtil.getIds(1, reisuueIdSeq).get(0)); int index = 0; for (MarriageDocument docs : marriageDocuments) { docs.setId(docIds.get(index++)); docs.setReissueCertificateId(reIssueApp.getId()); } try { kafkaTemplate.send(propertiesManager.getCreateReissueMarriageRegnTopicName(), propertiesManager.getCreateReissueMarriageRegnKey(), reissueCertRequest); } catch (Exception e) { e.printStackTrace(); } reissueCertAppl.add(reIssueApp); return getMarriageCertResponse(reissueCertAppl, reissueCertRequest.getRequestInfo()); }  ReissueCertResponse getMarriageCerts(MarriageCertCriteria marriageCertCriteria, RequestInfo requestInfo); ReissueCertResponse createAsync(ReissueCertRequest reissueCertRequest); ReissueCertResponse updateAsync(ReissueCertRequest reissueCertRequest); void certificateCreateAsync(ReissueCertAppl reIssueApp); void createCert(ReissueCertAppl reIssueApp); void create(ReissueCertRequest reissueCertRequest); void update(ReissueCertRequest reissueCertRequest); }
MarriageCertService { public ReissueCertResponse createAsync(ReissueCertRequest reissueCertRequest) { List<MarriageDocument> marriageDocuments = reissueCertRequest.getReissueApplication().getDocuments(); ReissueCertAppl reIssueApp = reissueCertRequest.getReissueApplication(); List<ReissueCertAppl> reissueCertAppl = new ArrayList<ReissueCertAppl>(); int docsSize = marriageDocuments.size(); List<String> docIds = sequenceGenUtil.getIds(docsSize, "egmr_documents_id"); reIssueApp.setId(sequenceGenUtil.getIds(1, reisuueIdSeq).get(0)); int index = 0; for (MarriageDocument docs : marriageDocuments) { docs.setId(docIds.get(index++)); docs.setReissueCertificateId(reIssueApp.getId()); } try { kafkaTemplate.send(propertiesManager.getCreateReissueMarriageRegnTopicName(), propertiesManager.getCreateReissueMarriageRegnKey(), reissueCertRequest); } catch (Exception e) { e.printStackTrace(); } reissueCertAppl.add(reIssueApp); return getMarriageCertResponse(reissueCertAppl, reissueCertRequest.getRequestInfo()); }  ReissueCertResponse getMarriageCerts(MarriageCertCriteria marriageCertCriteria, RequestInfo requestInfo); ReissueCertResponse createAsync(ReissueCertRequest reissueCertRequest); ReissueCertResponse updateAsync(ReissueCertRequest reissueCertRequest); void certificateCreateAsync(ReissueCertAppl reIssueApp); void createCert(ReissueCertAppl reIssueApp); void create(ReissueCertRequest reissueCertRequest); void update(ReissueCertRequest reissueCertRequest);  }