@Test public void testCreateCert() { int[] value = new int[] { 2, 6 }; when(jdbcTemplate.batchUpdate(any(String.class), any(List.class))).thenReturn(value); marriageCertRepository.createCert(getReissueCertAppl()); }
public void createCert(ReissueCertAppl reissueApp){ try { jdbcTemplate.update(create_Certificate_Query, new PreparedStatementSetter(){ MarriageCertificate marriageCertificate=reissueApp.getCertificate(); @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1,marriageCertificate.getCertificateNo()); ps.setLong(2,marriageCertificate.getCertificateDate()); ps.setString(3,marriageCertificate.getCertificateType().toString()); ps.setString(4,marriageCertificate.getRegnNumber()); ps.setString(5,marriageCertificate.getBridegroomPhoto()); ps.setString(6,marriageCertificate.getBridePhoto()); ps.setString(7,marriageCertificate.getHusbandName()); ps.setString(8,marriageCertificate.getHusbandAddress()); ps.setString(9,marriageCertificate.getWifeName()); ps.setString(10,marriageCertificate.getWifeAddress()); ps.setLong (11,marriageCertificate.getMarriageDate()); ps.setString(12,marriageCertificate.getMarriageVenueAddress()); ps.setLong (13,marriageCertificate.getRegnDate()); ps.setString(14,marriageCertificate.getRegnSerialNo()); ps.setString(15,marriageCertificate.getRegnVolumeNo()); ps.setString(16,marriageCertificate.getCertificatePlace()); ps.setString(17,marriageCertificate.getTemplateVersion()); ps.setString(18,marriageCertificate.getApplicationNumber()); ps.setString(19,marriageCertificate.getTenantId()); } }); } catch (DataAccessException e) { e.printStackTrace(); } }
MarriageCertRepository { public void createCert(ReissueCertAppl reissueApp){ try { jdbcTemplate.update(create_Certificate_Query, new PreparedStatementSetter(){ MarriageCertificate marriageCertificate=reissueApp.getCertificate(); @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1,marriageCertificate.getCertificateNo()); ps.setLong(2,marriageCertificate.getCertificateDate()); ps.setString(3,marriageCertificate.getCertificateType().toString()); ps.setString(4,marriageCertificate.getRegnNumber()); ps.setString(5,marriageCertificate.getBridegroomPhoto()); ps.setString(6,marriageCertificate.getBridePhoto()); ps.setString(7,marriageCertificate.getHusbandName()); ps.setString(8,marriageCertificate.getHusbandAddress()); ps.setString(9,marriageCertificate.getWifeName()); ps.setString(10,marriageCertificate.getWifeAddress()); ps.setLong (11,marriageCertificate.getMarriageDate()); ps.setString(12,marriageCertificate.getMarriageVenueAddress()); ps.setLong (13,marriageCertificate.getRegnDate()); ps.setString(14,marriageCertificate.getRegnSerialNo()); ps.setString(15,marriageCertificate.getRegnVolumeNo()); ps.setString(16,marriageCertificate.getCertificatePlace()); ps.setString(17,marriageCertificate.getTemplateVersion()); ps.setString(18,marriageCertificate.getApplicationNumber()); ps.setString(19,marriageCertificate.getTenantId()); } }); } catch (DataAccessException e) { e.printStackTrace(); } } }
MarriageCertRepository { public void createCert(ReissueCertAppl reissueApp){ try { jdbcTemplate.update(create_Certificate_Query, new PreparedStatementSetter(){ MarriageCertificate marriageCertificate=reissueApp.getCertificate(); @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1,marriageCertificate.getCertificateNo()); ps.setLong(2,marriageCertificate.getCertificateDate()); ps.setString(3,marriageCertificate.getCertificateType().toString()); ps.setString(4,marriageCertificate.getRegnNumber()); ps.setString(5,marriageCertificate.getBridegroomPhoto()); ps.setString(6,marriageCertificate.getBridePhoto()); ps.setString(7,marriageCertificate.getHusbandName()); ps.setString(8,marriageCertificate.getHusbandAddress()); ps.setString(9,marriageCertificate.getWifeName()); ps.setString(10,marriageCertificate.getWifeAddress()); ps.setLong (11,marriageCertificate.getMarriageDate()); ps.setString(12,marriageCertificate.getMarriageVenueAddress()); ps.setLong (13,marriageCertificate.getRegnDate()); ps.setString(14,marriageCertificate.getRegnSerialNo()); ps.setString(15,marriageCertificate.getRegnVolumeNo()); ps.setString(16,marriageCertificate.getCertificatePlace()); ps.setString(17,marriageCertificate.getTemplateVersion()); ps.setString(18,marriageCertificate.getApplicationNumber()); ps.setString(19,marriageCertificate.getTenantId()); } }); } catch (DataAccessException e) { e.printStackTrace(); } }  }
MarriageCertRepository { public void createCert(ReissueCertAppl reissueApp){ try { jdbcTemplate.update(create_Certificate_Query, new PreparedStatementSetter(){ MarriageCertificate marriageCertificate=reissueApp.getCertificate(); @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1,marriageCertificate.getCertificateNo()); ps.setLong(2,marriageCertificate.getCertificateDate()); ps.setString(3,marriageCertificate.getCertificateType().toString()); ps.setString(4,marriageCertificate.getRegnNumber()); ps.setString(5,marriageCertificate.getBridegroomPhoto()); ps.setString(6,marriageCertificate.getBridePhoto()); ps.setString(7,marriageCertificate.getHusbandName()); ps.setString(8,marriageCertificate.getHusbandAddress()); ps.setString(9,marriageCertificate.getWifeName()); ps.setString(10,marriageCertificate.getWifeAddress()); ps.setLong (11,marriageCertificate.getMarriageDate()); ps.setString(12,marriageCertificate.getMarriageVenueAddress()); ps.setLong (13,marriageCertificate.getRegnDate()); ps.setString(14,marriageCertificate.getRegnSerialNo()); ps.setString(15,marriageCertificate.getRegnVolumeNo()); ps.setString(16,marriageCertificate.getCertificatePlace()); ps.setString(17,marriageCertificate.getTemplateVersion()); ps.setString(18,marriageCertificate.getApplicationNumber()); ps.setString(19,marriageCertificate.getTenantId()); } }); } catch (DataAccessException e) { e.printStackTrace(); } }  void insert(MarriageRegn marriageRegn); List<ReissueCertAppl> findForCriteria(MarriageCertCriteria marriageCertCriteria); void createDoc(ReissueCertRequest reissueAppRequest); void updateDoc(ReissueCertRequest reissueAppRequest); void createReissue(ReissueCertRequest reissueAppRequest); void updateReissue(ReissueCertRequest reissueAppRequest); void createCert(ReissueCertAppl reissueApp); }
MarriageCertRepository { public void createCert(ReissueCertAppl reissueApp){ try { jdbcTemplate.update(create_Certificate_Query, new PreparedStatementSetter(){ MarriageCertificate marriageCertificate=reissueApp.getCertificate(); @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1,marriageCertificate.getCertificateNo()); ps.setLong(2,marriageCertificate.getCertificateDate()); ps.setString(3,marriageCertificate.getCertificateType().toString()); ps.setString(4,marriageCertificate.getRegnNumber()); ps.setString(5,marriageCertificate.getBridegroomPhoto()); ps.setString(6,marriageCertificate.getBridePhoto()); ps.setString(7,marriageCertificate.getHusbandName()); ps.setString(8,marriageCertificate.getHusbandAddress()); ps.setString(9,marriageCertificate.getWifeName()); ps.setString(10,marriageCertificate.getWifeAddress()); ps.setLong (11,marriageCertificate.getMarriageDate()); ps.setString(12,marriageCertificate.getMarriageVenueAddress()); ps.setLong (13,marriageCertificate.getRegnDate()); ps.setString(14,marriageCertificate.getRegnSerialNo()); ps.setString(15,marriageCertificate.getRegnVolumeNo()); ps.setString(16,marriageCertificate.getCertificatePlace()); ps.setString(17,marriageCertificate.getTemplateVersion()); ps.setString(18,marriageCertificate.getApplicationNumber()); ps.setString(19,marriageCertificate.getTenantId()); } }); } catch (DataAccessException e) { e.printStackTrace(); } }  void insert(MarriageRegn marriageRegn); List<ReissueCertAppl> findForCriteria(MarriageCertCriteria marriageCertCriteria); void createDoc(ReissueCertRequest reissueAppRequest); void updateDoc(ReissueCertRequest reissueAppRequest); void createReissue(ReissueCertRequest reissueAppRequest); void updateReissue(ReissueCertRequest reissueAppRequest); void createCert(ReissueCertAppl reissueApp); static final String CERTIFICATE_INSERT_QUERY; final String GET_APPLICATION_NO_QUERY; final String create_Certificate_Query; }