ManagerReportRowMapper implements RowMapper<ManagerReportEntryDto> { @Override public ManagerReportEntryDto mapRow(ResultSet rs, int rowNum) throws SQLException { final ManagerReportEntryDto entry = new ManagerReportEntryDto(); entry.setAccountCreatedDate(convertTimestamptoDate(rs .getLong("revtstmp"))); entry.setCreatedByStaffAdministrator(createStaffAdministratorNameFromResultSet(rs)); entry.setPatientFirstName(rs.getString("patient_first_name")); entry.setPatientGender(rs.getString("code")); entry.setPatientBirthDay(rs.getDate("birth_day")); entry.setActiveAccountDateTime(convertTimestamptoDate(rs.getLong("active_account_date_time"))); entry.setConsentInitialDateTime(rs.getDate("consent_initial_date_time")); entry.setPatientLastName(rs.getString("patient_last_name")); entry.setPatientMrn(rs.getString("medical_record_number")); entry.setPatientUsername(rs.getString("patient_user_name")); entry.setNumOfSignedConsents(rs.getInt("num_of_signed_consents")); entry.setStaffAdministratorLocation(rs.getString("employee_id")); entry.setNumOfUnsignedConsents(rs.getInt("num_of_unsigned_consents")); entry.setNumOfEffectiveConsents(rs.getInt("num_of_effective_consents")); entry.setNumOfRevokedConsents(rs.getInt("num_of_revoked_consents")); entry.setNumOfExpiredConsents(rs.getInt("num_of_expired_consents")); return entry; }  @Override ManagerReportEntryDto mapRow(ResultSet rs, int rowNum);  }
@Test public void testMapRow() throws SQLException { final ResultSet rs = mock(ResultSet.class); final Long revtstmp = 1427736147200L; when(rs.getLong("revtstmp")).thenReturn(revtstmp); final Long active_account_date_time = 1427736147200L; when(rs.getLong("active_account_date_time")).thenReturn(active_account_date_time); final String admin_first_name = "admin_first_name"; when(rs.getString(admin_first_name)).thenReturn(admin_first_name); final String patient_first_name = "patient_first_name"; when(rs.getString(patient_first_name)).thenReturn(patient_first_name); final String patient_user_name = "patient_user_name"; when(rs.getString(patient_user_name)).thenReturn(patient_user_name); final String admin_last_name = "admin_last_name"; when(rs.getString(admin_last_name)).thenReturn(admin_last_name); final String code = "code"; when(rs.getString(code)).thenReturn(code); final String patient_last_name = "patient_last_name"; when(rs.getString(patient_last_name)).thenReturn(patient_last_name); final String medical_record_number = "medical_record_number"; when(rs.getString(medical_record_number)).thenReturn( medical_record_number); final Integer num_of_signed_consents = 10; when(rs.getInt("num_of_signed_consents")).thenReturn(num_of_signed_consents); final String employee_id = "employee_id"; when(rs.getString(employee_id)).thenReturn(employee_id); final Integer num_of_unsigned_consents = 3; when(rs.getInt("num_of_unsigned_consents")).thenReturn(num_of_unsigned_consents); final Integer num_of_effective_consents = 4; when(rs.getInt("num_of_effective_consents")).thenReturn(num_of_effective_consents); final Integer num_of_revoked_consents = 5; when(rs.getInt("num_of_revoked_consents")).thenReturn(num_of_revoked_consents); final Integer num_of_expired_consents = 6; when(rs.getInt("num_of_expired_consents")).thenReturn(num_of_expired_consents); final ManagerReportEntryDto row = sut.mapRow(rs, 0); assertTrue(row.getAccountCreatedDate() != null); assertTrue(row.getAccountCreatedDate() instanceof Date); assertTrue(row.getActiveAccountDateTime() instanceof Date); assertEquals(admin_first_name + " " + admin_last_name, row.getCreatedByStaffAdministrator()); assertEquals(patient_first_name, row.getPatientFirstName()); assertEquals(code, row.getPatientGender()); assertEquals(patient_last_name, row.getPatientLastName()); assertEquals(patient_user_name, row.getPatientUsername()); assertEquals(medical_record_number, row.getPatientMrn()); assertEquals(num_of_signed_consents.intValue(), row.getNumOfSignedConsents()); assertEquals(employee_id, row.getStaffAdministratorLocation()); assertEquals(num_of_unsigned_consents.intValue(), row.getNumOfUnsignedConsents()); assertEquals(num_of_effective_consents.intValue(), row.getNumOfEffectiveConsents()); assertEquals(num_of_revoked_consents.intValue(), row.getNumOfRevokedConsents()); assertEquals(num_of_expired_consents.intValue(), row.getNumOfExpiredConsents()); }