SpringJdbcRecordMapper implements RecordMapper<ResultSet, P> { @Override public Record<P> processRecord(Record<ResultSet> record) throws Exception { ResultSet resultSet = record.getPayload(); BeanPropertyRowMapper<P> beanPropertyRowMapper = new BeanPropertyRowMapper<>(type); return new GenericRecord<>(record.getHeader(), beanPropertyRowMapper.mapRow(resultSet, record.getHeader().getNumber().intValue())); } SpringJdbcRecordMapper(Class<P> type); @Override Record<P> processRecord(Record<ResultSet> record);  }
@Test public void testMapRecord() throws Exception { when(payload.getMetaData()).thenReturn(metadata); when(metadata.getColumnCount()).thenReturn(3); when(metadata.getColumnLabel(1)).thenReturn("id"); when(metadata.getColumnLabel(2)).thenReturn("user"); when(metadata.getColumnLabel(3)).thenReturn("message"); when(payload.getInt(1)).thenReturn(1); when(payload.getString(2)).thenReturn("foo"); when(payload.getString(3)).thenReturn("message"); Record<Tweet> actual = mapper.processRecord(jdbcRecord); assertThat(actual.getHeader()).isEqualTo(header); assertThat(actual.getPayload()).isEqualTo(new Tweet(1, "foo", "message")); }