RevokedConsentDtoRowMapper implements RowMapper<RevokedConsentDto> { @Override public RevokedConsentDto mapRow(ResultSet rs, int rowNum) throws SQLException { long pcmConsentId = rs.getLong("consent.id"); String policyId = rs.getString("consent.consent_reference_id"); String patientEid = rs.getString("patient.enterprise_identifier"); String patientMrn = rs.getString("patient.medical_record_number"); long pcmPatientId = rs.getLong("consent.patient"); byte[] revokedPdfConsent = lobHandler .getBlobAsBytes(rs, "signedpdfconsent_revocation.signed_pdf_consent_revocation_content"); RevokedConsentDto revokedConsentDto = new RevokedConsentDto(); revokedConsentDto.setPatientEid(patientEid); revokedConsentDto.setPatientMrn(patientMrn); revokedConsentDto.setPcmConsentId(pcmConsentId); revokedConsentDto.setPcmPatientId(pcmPatientId); revokedConsentDto.setRevokedPdfConsent(revokedPdfConsent); revokedConsentDto.setXacmlCcdId(policyId); return revokedConsentDto; } RevokedConsentDtoRowMapper(LobHandler lobHandler); @Override RevokedConsentDto mapRow(ResultSet rs, int rowNum);  }
@Test public void testMapRow() throws SQLException { ResultSet rsMock = mock(ResultSet.class); long consentIdMock = 1; String policyIdMock = "policyIdMock"; String patientIdMock = "patientIdMock"; byte[] revokedConsentPdfMock = new byte[1]; when(rsMock.getLong("consent.id")).thenReturn(consentIdMock); when(rsMock.getString("consent.consent_reference_id")).thenReturn( policyIdMock); when(rsMock.getString("patient.enterprise_identifier")).thenReturn( patientIdMock); when( lobHandlerMock .getBlobAsBytes(rsMock, "signedpdfconsent_revocation.signed_pdf_consent_revocation_content")) .thenReturn(revokedConsentPdfMock); RevokedConsentDto result = sut.mapRow(rsMock, 1); assertEquals(consentIdMock, result.getPcmConsentId()); assertEquals(policyIdMock, result.getXacmlCcdId()); assertEquals(patientIdMock, result.getPatientEid()); assertEquals(revokedConsentPdfMock, result.getRevokedPdfConsent()); }