@Test public void testMapRow() throws SQLException { ResultSet rsMock = mock(ResultSet.class); int iMock = 1; long consentIdMock = 2; long patientIdMock = 3; String mrnMock = "mrnMock"; String consentMock = "consentMock"; byte[] consentMockBytes = consentMock.getBytes(); byte[] signedConsentPdfBytes = new byte[1]; when(rsMock.getLong("id")).thenReturn(consentIdMock); when(rsMock.getLong("consent.patient")).thenReturn(patientIdMock); when(rsMock.getString("patient.medical_record_number")).thenReturn( mrnMock); when(lobHandlerMock.getBlobAsBytes(rsMock, "consent.xacml_ccd")) .thenReturn(consentMockBytes); when( lobHandlerMock.getBlobAsBytes(rsMock, "consent.xacml_pdf_consent_from")).thenReturn( consentMockBytes); when( lobHandlerMock.getBlobAsBytes(rsMock, "consent.xacml_pdf_consent_to")).thenReturn( consentMockBytes); when( lobHandlerMock.getBlobAsBytes(rsMock, "signedpdfconsent.signed_pdf_consent_content")) .thenReturn(signedConsentPdfBytes); SignedConsentDto response = sut.mapRow(rsMock, iMock); assertEquals(consentMockBytes, response.getXacmlCcd()); assertEquals(consentMock, new String(response.getXacmlCcd())); assertEquals(mrnMock, response.getPatientMrn()); assertEquals(patientIdMock, response.getPcmPatientId()); assertEquals(signedConsentPdfBytes, response.getSignedPdfConsent()); }
@Override public SignedConsentDto mapRow(ResultSet rs, int i) throws SQLException { long pcmConsentId = rs.getLong("consent.id"); long pcmPatientId = rs.getLong("consent.patient"); byte[] xacmlCcd = lobHandler.getBlobAsBytes(rs, "consent.xacml_ccd"); byte[] xacmlPdfConsentFrom = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_from"); byte[] xacmlPdfConsentTo = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_to"); byte[] signedPdfConsent = lobHandler.getBlobAsBytes(rs, "signedpdfconsent.signed_pdf_consent_content"); String xacmlCcdId = rs.getString("consent.consent_reference_id"); String patientMrn = rs.getString("patient.medical_record_number"); logger.info("MRN:" + patientMrn + "; PatientId:" + pcmPatientId + "; Consent:" + pcmConsentId + " is fetched."); logger.debug("Consent File:\n" + (new String(xacmlCcd))); SignedConsentDto signedConsentDto = new SignedConsentDto(); signedConsentDto.setPatientMrn(patientMrn); signedConsentDto.setPcmConsentId(Long.toString(pcmConsentId)); signedConsentDto.setPcmPatientId(pcmPatientId); signedConsentDto.setSignedPdfConsent(signedPdfConsent); signedConsentDto.setXacmlCcd(xacmlCcd); signedConsentDto.setXacmlCcdId(xacmlCcdId); signedConsentDto.setXacmlPdfConsentFrom(xacmlPdfConsentFrom); signedConsentDto.setXacmlPdfConsentTo(xacmlPdfConsentTo); return signedConsentDto; }
SignedConsentDtoRowMapper implements RowMapper<SignedConsentDto> { @Override public SignedConsentDto mapRow(ResultSet rs, int i) throws SQLException { long pcmConsentId = rs.getLong("consent.id"); long pcmPatientId = rs.getLong("consent.patient"); byte[] xacmlCcd = lobHandler.getBlobAsBytes(rs, "consent.xacml_ccd"); byte[] xacmlPdfConsentFrom = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_from"); byte[] xacmlPdfConsentTo = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_to"); byte[] signedPdfConsent = lobHandler.getBlobAsBytes(rs, "signedpdfconsent.signed_pdf_consent_content"); String xacmlCcdId = rs.getString("consent.consent_reference_id"); String patientMrn = rs.getString("patient.medical_record_number"); logger.info("MRN:" + patientMrn + "; PatientId:" + pcmPatientId + "; Consent:" + pcmConsentId + " is fetched."); logger.debug("Consent File:\n" + (new String(xacmlCcd))); SignedConsentDto signedConsentDto = new SignedConsentDto(); signedConsentDto.setPatientMrn(patientMrn); signedConsentDto.setPcmConsentId(Long.toString(pcmConsentId)); signedConsentDto.setPcmPatientId(pcmPatientId); signedConsentDto.setSignedPdfConsent(signedPdfConsent); signedConsentDto.setXacmlCcd(xacmlCcd); signedConsentDto.setXacmlCcdId(xacmlCcdId); signedConsentDto.setXacmlPdfConsentFrom(xacmlPdfConsentFrom); signedConsentDto.setXacmlPdfConsentTo(xacmlPdfConsentTo); return signedConsentDto; } }
SignedConsentDtoRowMapper implements RowMapper<SignedConsentDto> { @Override public SignedConsentDto mapRow(ResultSet rs, int i) throws SQLException { long pcmConsentId = rs.getLong("consent.id"); long pcmPatientId = rs.getLong("consent.patient"); byte[] xacmlCcd = lobHandler.getBlobAsBytes(rs, "consent.xacml_ccd"); byte[] xacmlPdfConsentFrom = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_from"); byte[] xacmlPdfConsentTo = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_to"); byte[] signedPdfConsent = lobHandler.getBlobAsBytes(rs, "signedpdfconsent.signed_pdf_consent_content"); String xacmlCcdId = rs.getString("consent.consent_reference_id"); String patientMrn = rs.getString("patient.medical_record_number"); logger.info("MRN:" + patientMrn + "; PatientId:" + pcmPatientId + "; Consent:" + pcmConsentId + " is fetched."); logger.debug("Consent File:\n" + (new String(xacmlCcd))); SignedConsentDto signedConsentDto = new SignedConsentDto(); signedConsentDto.setPatientMrn(patientMrn); signedConsentDto.setPcmConsentId(Long.toString(pcmConsentId)); signedConsentDto.setPcmPatientId(pcmPatientId); signedConsentDto.setSignedPdfConsent(signedPdfConsent); signedConsentDto.setXacmlCcd(xacmlCcd); signedConsentDto.setXacmlCcdId(xacmlCcdId); signedConsentDto.setXacmlPdfConsentFrom(xacmlPdfConsentFrom); signedConsentDto.setXacmlPdfConsentTo(xacmlPdfConsentTo); return signedConsentDto; } SignedConsentDtoRowMapper();  SignedConsentDtoRowMapper(LobHandler lobHandler); }
SignedConsentDtoRowMapper implements RowMapper<SignedConsentDto> { @Override public SignedConsentDto mapRow(ResultSet rs, int i) throws SQLException { long pcmConsentId = rs.getLong("consent.id"); long pcmPatientId = rs.getLong("consent.patient"); byte[] xacmlCcd = lobHandler.getBlobAsBytes(rs, "consent.xacml_ccd"); byte[] xacmlPdfConsentFrom = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_from"); byte[] xacmlPdfConsentTo = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_to"); byte[] signedPdfConsent = lobHandler.getBlobAsBytes(rs, "signedpdfconsent.signed_pdf_consent_content"); String xacmlCcdId = rs.getString("consent.consent_reference_id"); String patientMrn = rs.getString("patient.medical_record_number"); logger.info("MRN:" + patientMrn + "; PatientId:" + pcmPatientId + "; Consent:" + pcmConsentId + " is fetched."); logger.debug("Consent File:\n" + (new String(xacmlCcd))); SignedConsentDto signedConsentDto = new SignedConsentDto(); signedConsentDto.setPatientMrn(patientMrn); signedConsentDto.setPcmConsentId(Long.toString(pcmConsentId)); signedConsentDto.setPcmPatientId(pcmPatientId); signedConsentDto.setSignedPdfConsent(signedPdfConsent); signedConsentDto.setXacmlCcd(xacmlCcd); signedConsentDto.setXacmlCcdId(xacmlCcdId); signedConsentDto.setXacmlPdfConsentFrom(xacmlPdfConsentFrom); signedConsentDto.setXacmlPdfConsentTo(xacmlPdfConsentTo); return signedConsentDto; } SignedConsentDtoRowMapper();  SignedConsentDtoRowMapper(LobHandler lobHandler); @Override SignedConsentDto mapRow(ResultSet rs, int i); }
SignedConsentDtoRowMapper implements RowMapper<SignedConsentDto> { @Override public SignedConsentDto mapRow(ResultSet rs, int i) throws SQLException { long pcmConsentId = rs.getLong("consent.id"); long pcmPatientId = rs.getLong("consent.patient"); byte[] xacmlCcd = lobHandler.getBlobAsBytes(rs, "consent.xacml_ccd"); byte[] xacmlPdfConsentFrom = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_from"); byte[] xacmlPdfConsentTo = lobHandler.getBlobAsBytes(rs, "consent.xacml_pdf_consent_to"); byte[] signedPdfConsent = lobHandler.getBlobAsBytes(rs, "signedpdfconsent.signed_pdf_consent_content"); String xacmlCcdId = rs.getString("consent.consent_reference_id"); String patientMrn = rs.getString("patient.medical_record_number"); logger.info("MRN:" + patientMrn + "; PatientId:" + pcmPatientId + "; Consent:" + pcmConsentId + " is fetched."); logger.debug("Consent File:\n" + (new String(xacmlCcd))); SignedConsentDto signedConsentDto = new SignedConsentDto(); signedConsentDto.setPatientMrn(patientMrn); signedConsentDto.setPcmConsentId(Long.toString(pcmConsentId)); signedConsentDto.setPcmPatientId(pcmPatientId); signedConsentDto.setSignedPdfConsent(signedPdfConsent); signedConsentDto.setXacmlCcd(xacmlCcd); signedConsentDto.setXacmlCcdId(xacmlCcdId); signedConsentDto.setXacmlPdfConsentFrom(xacmlPdfConsentFrom); signedConsentDto.setXacmlPdfConsentTo(xacmlPdfConsentTo); return signedConsentDto; } SignedConsentDtoRowMapper();  SignedConsentDtoRowMapper(LobHandler lobHandler); @Override SignedConsentDto mapRow(ResultSet rs, int i);  }